F.A.Qs Home ProblemSet Status Ranklist Contest LoginRegister
Notice:祝各位Oier新年快乐,Rp++!
大视野在线测评-欢迎您
[ New Thread ]
Problem 1012 >> 【求助】别的OJ AC,BZOJ RE?
YoungNeal @ 2018-02-14 19:59:38
[ Quote ] [ Edit ] [ Delete ] 1#
贴代码
#include<cstdio>
#include<iostream>
#define N 200005
using namespace std;

string a;
int m,p;
int top,cnt,last;
int stk[N],val[N];

int main(){
scanf("%d%d",&m,&p);
for(int i=1;i<=m;i++){
int x;
cin>>a>>x;
if(a=="A"){
x=(x+last)%p;
while(top&&x>stk[top]) top--;
stk[++top]=x;
val[top]=++cnt;
}
else{
if(x==0){
printf("0\n");
last=0;
continue;
}
int l=1,r=top,ans;
while(l<=r){
int mid=l+r>>1;
if(cnt-x+1<=val[mid])
ans=mid,r=mid-1;
else
l=mid+1;
}
last=stk[ans];
printf("%d\n",stk[ans]);
}
}
return 0;
}
wdmmsyf @ 2018-02-17 21:04:40
[ Quote ] [ Edit ] [ Delete ] 2#
代码明显有问题,你别的OJ是怎么A的。。
19992147 @ 2018-02-17 22:11:16
[ Quote ] [ Edit ] [ Delete ] 3#
stl @ 2018-02-18 00:18:40
[ Quote ] [ Edit ] [ Delete ] 4#
cin一时爽
EdwardFrog @ 2018-02-18 10:21:08
[ Quote ] [ Edit ] [ Delete ] 5#
RE火葬场
[Top] [Previous Page] [Next Page]

HOME Back