当前位置: 首页 > news >正文

网络培训网站/营销推广的平台

网络培训网站,营销推广的平台,iis服务器的默认网站,大数据营销的弊端http://www.lydsy.com/JudgeOnline/problem.php?id1503 用w值记录它的加减情况,加(减)操作加在w上加(减)val,当新来一个的时候你插入树中应该是以前工资未变化时的相对值,也就是val-w // File …

http://www.lydsy.com/JudgeOnline/problem.php?id=1503

用w值记录它的加减情况,加(减)操作加在w上加(减)val,当新来一个的时候你插入树中应该是以前工资未变化时的相对值,也就是val-w

// File Name: ACM/bzoj/1503.cpp
// Author: Zlbing
// Created Time: 2013年08月08日 星期四 14时29分46秒

#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<stack>
#include<cmath>
#include<queue>
using namespace std;
#define CL(x,v); memset(x,v,sizeof(x));
#define INF 0x3f3f3f3f
#define LL long long
#define REP(i,r,n) for(int i=r;i<=n;i++)
#define RREP(i,n,r) for(int i=n;i>=r;i--)
const int MAXN=2e5+100;
int lim;
struct SplayTree {  int sz[MAXN];  int ch[MAXN][2];  int pre[MAXN];  int rt,top;  inline void up(int x){  sz[x]  = cnt[x]  + sz[ ch[x][0] ] + sz[ ch[x][1] ];  }  inline void Rotate(int x,int f){  int y=pre[x];  ch[y][!f] = ch[x][f];  pre[ ch[x][f] ] = y;  pre[x] = pre[y];  if(pre[x]) ch[ pre[y] ][ ch[pre[y]][1] == y ] =x;  ch[x][f] = y;  pre[y] = x;  up(y);  }  inline void Splay(int x,int goal){//将x旋转到goal的下面  while(pre[x] != goal){  if(pre[pre[x]] == goal) Rotate(x , ch[pre[x]][0] == x);  else   {  int y=pre[x],z=pre[y];  int f = (ch[z][0]==y);  if(ch[y][f] == x) Rotate(x,!f),Rotate(x,f);  else Rotate(y,f),Rotate(x,f);  }  }  up(x);  if(goal==0) rt=x;  }  inline void RTO(int k,int goal){//将第k位数旋转到goal的下面  int x=rt;  while(sz[ ch[x][0] ] != k-1) {  if(k < sz[ ch[x][0] ]+1) x=ch[x][0];  else {  k-=(sz[ ch[x][0] ]+1);  x = ch[x][1];  }  }  Splay(x,goal);  }  inline void vist(int x){  if(x){  printf("结点%2d : 左儿子  %2d   右儿子  %2d   %2d sz=%d\n",x,ch[x][0],ch[x][1],val[x],sz[x]);  vist(ch[x][0]);  vist(ch[x][1]);  }  }  inline void Newnode(int &x,int c){  x=++top;  ch[x][0] = ch[x][1] = pre[x] = 0;  sz[x]=1; cnt[x]=1;  val[x] = c;  }  inline void init(){  sum=ch[0][0]=ch[0][1]=pre[0]=sz[0]=0;  rt=top=0; cnt[0]=0;  }  inline void Insert(int &x,int key,int f){  if(!x) {  Newnode(x,key);  pre[x]=f;  Splay(x,0);  return ;  }  if(key==val[x]){  cnt[x]++;  sz[x]++;  Splay(x,0);  return ;  }else if(key<val[x]) {  Insert(ch[x][0],key,x);  } else {  Insert(ch[x][1],key,x);  }  up(x);  }  void del(int &x,int f){  if(!x) return ;  if(val[x]>=lim){  del(ch[x][0],x);  } else {  sum+=sz[ch[x][0]]+cnt[x];  x=ch[x][1];   pre[x]=f;  if(f==0) rt=x;  del(x,f);  }  if(x)  up(x);  }  inline void update(){  del(rt,0);  }  inline int find_kth(int x,int k){  if(k<sz[ch[x][0]]+1) {  return find_kth(ch[x][0],k);  }else if(k > sz[ ch[x][0] ] + cnt[x] )   return find_kth(ch[x][1],k-sz[ch[x][0]]-cnt[x]);  else{   Splay(x,0);  return val[x];  }  }  int cnt[MAXN];  int val[MAXN];  int sum;  
}spt;  
int main()
{int n;int m;char op[5];scanf("%d%d",&n,&m);int w=0;spt.init();while(n--){int k;scanf("%s%d",op,&k);if(op[0]=='I'){if(k<m){continue;}spt.Insert(spt.rt,k-w,0);}else if(op[0]=='A'){w+=k;}else if(op[0]=='S'){w-=k;lim=m-w;spt.update();}else{int sz=spt.sz[spt.rt];if(k>sz)printf("-1\n");else {printf("%d\n",spt.find_kth(spt.rt,sz-k+1)+w);}}}printf("%d\n",spt.sum);return 0;
}

 

转载于:https://www.cnblogs.com/arbitrary/p/3248317.html

http://www.lbrq.cn/news/736723.html

相关文章:

  • 网页版抖音入口官网/台州百度推广优化
  • 做的视频发到哪个网站好/2023半夜免费b站推广
  • 长春网站建设工作室/百度seo如何做
  • 动态网站建设与规划/seo优化排名价格
  • 做一个简单网站/推广软件排行榜前十名
  • 常州做网站公司哪家好/百度收录查询
  • 建设网站需要了解些什么/举出最新的网络营销的案例
  • 英文网站备案/2023新闻摘抄大全
  • 网站建设 收费明细/seo全称
  • 南宁市疫情最新情况详细地址/南宁seo推广
  • 网站优化方案ppt/网络营销推广合作
  • 自己网站上做淘宝搜索/站长统计app软件
  • 那家公司做网站比较好/十八未成年禁用免费app
  • 大连网络推广宣传/杭州seo靠谱
  • 为什么要用模板建站/营销推广文案
  • 上海专业网站建设服/如何做运营推广
  • 企业网站维护更新/长尾词和关键词的区别
  • 开发网站需要哪些技术/免费创建网站平台
  • 技术支持 优府网络太原网站建设/广告加盟
  • wordpress插件用户权限/东莞seo网站优化排名
  • 苏州网站设计公司/2023疫情最新消息今天
  • 青岛百度快速排名优化/什么是seo优化
  • 家用电脑和宽带做网站/发布友情链接
  • 织梦制作html 网站地图/四川seo哪里有
  • 在哪个网站做图片视频带音乐/网站建站开发
  • 电子政务网站建设/百度关键词首页排名
  • 购买 做网站 客户/石家庄百度推广优化排名
  • 免费空间申请free/广州网站优化外包
  • 哪个网站可以改字体/seo关键词优化软件app
  • 怎么做网站或APP/德芙巧克力的软文500字
  • 粗粮厂的基于flink的汽车实时数仓解决方案
  • Docker:安装配置
  • Trae AI 超级团队
  • 力扣hot100:无重复字符的最长子串,找到字符串中所有字母异位词(滑动窗口算法讲解)(3,438)
  • C++---滑动窗口平滑数据
  • 打工人项目日报计划