#include<bits/stdc++.h>
#define re register
#define ui unsigned long long
using namespace std;
const int Mxdt=1000000;
inline char gc(){
static char buf[Mxdt],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,Mxdt,stdin),p1==p2)?EOF:*p1++;
}
inline char pc(char ch,bool bj){
static char buf[Mxdt],*p1=buf,*p2=buf+Mxdt;
return (bj||(*p1++=ch)&&p1==p2)&&fwrite(p1=buf,1,p1-buf,stdout),0;
}
inline int read(){
re int t=0,f=0;re char v=gc();
while(v<'0')f|=(v=='-'),v=gc();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=gc();
return f?-t:t;
}
ui A[2][1100002];
int Z,n,m;
set<int>S;
set<int>::iterator it;
inline void add(re int x,re ui y){
if(A[Z][x]+y<A[Z][x])add(x+1,1);
A[Z][x]+=y;
if(A[Z][x]^A[Z^1][x])S.insert(x);
else if(S.find(x)!=S.end())S.erase(x);
}
int main(){
n=read(),read(),read(),read();
while(n--){
re int o=read(),X=read();
if(o==1){
if(X>0)Z=0;
else X=-X,Z=1;
re ui x=X,y=read();
re int p1=y>>6,p2=y&63;
add(p1,x<<p2);if(p2)add(p1+1,x>>(64-p2));
}
else{
re int ans,p1=X>>6,p2=X&63,ia=0;
re ui v1=A[0][p1],v2=A[1][p1];
ans=(v1>>p2&1)^(v2>>p2&1);
if(p2){
v1&=(1ull<<p2)-1,v2&=(1ull<<p2)-1;
if(v1>v2)ia=1;
else if(v1<v2)ia=1,ans^=1;
}
if(!ia){
it=S.lower_bound(p1);
if(it!=S.begin()){
--it;
if(A[0][*it]<A[1][*it])ans^=1;
}
}
pc(ans+'0',0),pc('\n',0);
}
}
pc('o',1);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 37.15 us | 48 KB | Accepted | Score: 4 | 显示更多 |
Testcase #2 | 45.7 us | 52 KB | Accepted | Score: 4 | 显示更多 |
Testcase #3 | 99.89 us | 72 KB | Accepted | Score: 4 | 显示更多 |
Testcase #4 | 219.22 us | 84 KB | Accepted | Score: 4 | 显示更多 |
Testcase #5 | 322.03 us | 132 KB | Accepted | Score: 4 | 显示更多 |
Testcase #6 | 377.87 us | 136 KB | Accepted | Score: 4 | 显示更多 |
Testcase #7 | 858.49 us | 340 KB | Accepted | Score: 4 | 显示更多 |
Testcase #8 | 614.89 us | 208 KB | Accepted | Score: 4 | 显示更多 |
Testcase #9 | 2.931 ms | 1 MB + 4 KB | Accepted | Score: 4 | 显示更多 |
Testcase #10 | 4.004 ms | 1 MB + 116 KB | Accepted | Score: 4 | 显示更多 |
Testcase #11 | 4.096 ms | 1 MB + 16 KB | Accepted | Score: 4 | 显示更多 |
Testcase #12 | 5.511 ms | 1 MB + 676 KB | Accepted | Score: 4 | 显示更多 |
Testcase #13 | 7.832 ms | 2 MB + 148 KB | Accepted | Score: 4 | 显示更多 |
Testcase #14 | 24.27 ms | 4 MB + 300 KB | Accepted | Score: 4 | 显示更多 |
Testcase #15 | 30.536 ms | 5 MB + 372 KB | Accepted | Score: 4 | 显示更多 |
Testcase #16 | 53.279 ms | 7 MB + 592 KB | Accepted | Score: 4 | 显示更多 |
Testcase #17 | 41.248 ms | 2 MB + 60 KB | Accepted | Score: 4 | 显示更多 |
Testcase #18 | 88.997 ms | 10 MB + 896 KB | Accepted | Score: 4 | 显示更多 |
Testcase #19 | 111.666 ms | 12 MB + 536 KB | Accepted | Score: 4 | 显示更多 |
Testcase #20 | 307.759 ms | 16 MB + 648 KB | Accepted | Score: 4 | 显示更多 |
Testcase #21 | 121.115 ms | 14 MB + 96 KB | Accepted | Score: 4 | 显示更多 |
Testcase #22 | 82.071 ms | 2 MB + 992 KB | Accepted | Score: 4 | 显示更多 |
Testcase #23 | 102.683 ms | 5 MB + 732 KB | Accepted | Score: 4 | 显示更多 |
Testcase #24 | 92.157 ms | 3 MB + 104 KB | Accepted | Score: 4 | 显示更多 |
Testcase #25 | 173.124 ms | 17 MB + 456 KB | Accepted | Score: 4 | 显示更多 |