#include<bits/stdc++.h>
using namespace std;
typedef long long L;
char *TT,*tmo,but[(1<<15)+2];
#define gc ((TT==tmo&&(tmo=((TT=but)+fread(but,1,1<<15,stdin)),TT==tmo))?-1:*TT++)
inline int rd(){
int x,f=1,c;for(;!isdigit(c=gc);)f=c!='-';x=c-'0';
for(;isdigit(c=gc);)x=x*10+c-'0';return f?x:-x;
}
#ifdef flukehn
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif
int n;
void add(set<int>&a,set<int>&b,int k){
for(;a.count(k);){
a.erase(k);
++k;
}
if(b.count(k))b.erase(k);
else a.insert(k);
}
set<int> a,b;
int qr(int k){
set<int>::iterator it,jt;
it=b.upper_bound(k);
if(it==b.begin())return a.count(k);
--it;
jt=a.upper_bound(*it);
if(jt==a.end())return 0;
if(*it==k){
return it==b.begin() || a.upper_bound(*(--it)) != jt;
}
return *jt>k || (*jt<k && a.count(k));
/*
if(jt!=a.end())debug("%d %d\n",*it,*jt);
return jt!=a.end() && (*jt>k || (*jt<k && a.count(k)));*/
}
int main(){
#ifdef flukehn
freopen("g.in","r",stdin);
#endif
n=rd(),rd(),rd(),rd();
int op,x,y,k;
for(;n--;){
op=rd();
if(op==2){
k=rd();
putchar(qr(k)+'0');
putchar('\n');
}else{
x=rd(),y=rd();
if(x>0){
for(int i=0;i<30;++i)
if(x>>i&1) add(a,b,y+i);
}else{
x=-x;
for(int i=0;i<30;++i)
if(x>>i&1) add(b,a,y+i);
}
/*int th=0;
for(int i:a)
th+=1<<i,debug("%d ",i);
debug("\n");
for(int i:b)
th-=1<<i,debug("%d ",i);
debug("\n");
debug("x=%d\n",th);*/
}
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 46.39 us | 44 KB | Accepted | Score: 4 | 显示更多 |
Testcase #2 | 180.76 us | 44 KB | Accepted | Score: 4 | 显示更多 |
Testcase #3 | 2.595 ms | 64 KB | Accepted | Score: 4 | 显示更多 |
Testcase #4 | 725.58 us | 140 KB | Accepted | Score: 4 | 显示更多 |
Testcase #5 | 4.856 ms | 92 KB | Accepted | Score: 4 | 显示更多 |
Testcase #6 | 882.57 us | 128 KB | Accepted | Score: 4 | 显示更多 |
Testcase #7 | 9.461 ms | 1 MB + 8 KB | Accepted | Score: 4 | 显示更多 |
Testcase #8 | 10.44 ms | 300 KB | Accepted | Score: 4 | 显示更多 |
Testcase #9 | 34.253 ms | 3 MB + 264 KB | Accepted | Score: 4 | 显示更多 |
Testcase #10 | 50.568 ms | 2 MB + 524 KB | Accepted | Score: 4 | 显示更多 |
Testcase #11 | 72.072 ms | 1 MB + 460 KB | Accepted | Score: 4 | 显示更多 |
Testcase #12 | 8.382 ms | 636 KB | Accepted | Score: 4 | 显示更多 |
Testcase #13 | 87.648 ms | 7 MB + 412 KB | Accepted | Score: 4 | 显示更多 |
Testcase #14 | 280.593 ms | 21 MB + 300 KB | Accepted | Score: 4 | 显示更多 |
Testcase #15 | 48.83 ms | 2 MB + 648 KB | Accepted | Score: 4 | 显示更多 |
Testcase #16 | 614.967 ms | 42 MB + 560 KB | Accepted | Score: 4 | 显示更多 |
Testcase #17 | 756.747 ms | 11 MB + 608 KB | Accepted | Score: 4 | 显示更多 |
Testcase #18 | 963.026 ms | 63 MB + 660 KB | Accepted | Score: 4 | 显示更多 |
Testcase #19 | 1.271 s | 74 MB + 136 KB | Accepted | Score: 4 | 显示更多 |
Testcase #20 | 367.061 ms | 18 MB + 1000 KB | Accepted | Score: 4 | 显示更多 |
Testcase #21 | 174.021 ms | 7 MB + 764 KB | Accepted | Score: 4 | 显示更多 |
Testcase #22 | 1.623 s | 21 MB + 448 KB | Accepted | Score: 4 | 显示更多 |
Testcase #23 | 1.454 s | 46 MB + 920 KB | Accepted | Score: 4 | 显示更多 |
Testcase #24 | 1.694 s | 22 MB + 840 KB | Accepted | Score: 4 | 显示更多 |
Testcase #25 | 1.817 s | 105 MB + 748 KB | Accepted | Score: 4 | 显示更多 |