#include<bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int N = 1e6+7;
char gc()
{
static char buf[100000], *p1 = buf, *p2 = buf;
return p1==p2&&(p2=(p1=buf)+fread(buf, 1, 100000, stdin), p1==p2) ? EOF : *p1++;
}
int qr()
{
char ch = gc();
int f = 1, sum = 0;
while(ch<'0'||ch>'9')
{
if(ch=='-')
{
f = -1;
}
ch = gc();
}
while(ch>='0'&&ch<='9')
{
sum = sum*10+ch-'0';
ch = gc();
}
return sum*f;
}
set<int> s;
ui x[N], y[N];
void ADD(ull a, int b, ui* t, ui* an)
{
int p = b/32, c = b%32;
ull tmp = (ull)t[p]+(a<<c);
a = tmp>>32;t[p] = (tmp&(((ull)1<<33)-1));
if(t[p]^an[p])
{
s.insert(p);
}
else
{
s.erase(p);
}
for(int i = p+1; a; i++)
{
tmp = (ull)t[i]+a;
a = (tmp)>>32;t[i] = (tmp&(((ull)1<<33)-1));
if(t[i]^an[i])
{
s.insert(i);
}
else
{
s.erase(i);
}
}
return;
}
bool query(int k)
{
int p = k/32, c = k%32;
ui ans = ((x[p]>>c)^(y[p]>>c))&1;
ui a = (x[p]&((1<<c)-1)), b = (y[p]&((1<<c)-1));
if(a<b)
{
return ans^1;
}
else if(a>b||s.empty()||p<=*s.begin())
{
return ans;
}
set<int>::iterator it = s.lower_bound(p);it--;
if(x[*it]>y[*it])
{
return ans;
}
return ans^1;
}
int main()
{
int n = qr(), t1 = qr(), t2 = qr(), t3 = qr();
for(int i = 1; i <= n; i++)
{
int o = qr(), a, b, k;
if(o&1)
{
a = qr();
b = qr();
if(a>0)
{
ADD(a, b, x, y);
}
else
{
ADD(-a, b, y, x);
}
}
else
{
printf("%d\n", query(qr()));
}
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 40.8 us | 48 KB | Accepted | Score: 4 | 显示更多 |
Testcase #2 | 70.76 us | 48 KB | Accepted | Score: 4 | 显示更多 |
Testcase #3 | 337.09 us | 68 KB | Accepted | Score: 4 | 显示更多 |
Testcase #4 | 643.6 us | 92 KB | Accepted | Score: 4 | 显示更多 |
Testcase #5 | 794.53 us | 140 KB | Accepted | Score: 4 | 显示更多 |
Testcase #6 | 913.46 us | 136 KB | Accepted | Score: 4 | 显示更多 |
Testcase #7 | 1.575 ms | 320 KB | Accepted | Score: 4 | 显示更多 |
Testcase #8 | 1.414 ms | 164 KB | Accepted | Score: 4 | 显示更多 |
Testcase #9 | 5.646 ms | 740 KB | Accepted | Score: 4 | 显示更多 |
Testcase #10 | 7.454 ms | 472 KB | Accepted | Score: 4 | 显示更多 |
Testcase #11 | 8.964 ms | 280 KB | Accepted | Score: 4 | 显示更多 |
Testcase #12 | 9.557 ms | 1 MB + 96 KB | Accepted | Score: 4 | 显示更多 |
Testcase #13 | 13.67 ms | 1 MB + 500 KB | Accepted | Score: 4 | 显示更多 |
Testcase #14 | 42.073 ms | 4 MB + 36 KB | Accepted | Score: 4 | 显示更多 |
Testcase #15 | 48.876 ms | 4 MB + 572 KB | Accepted | Score: 4 | 显示更多 |
Testcase #16 | 87.757 ms | 7 MB + 952 KB | Accepted | Score: 4 | 显示更多 |
Testcase #17 | 83.978 ms | 1 MB + 268 KB | Accepted | Score: 4 | 显示更多 |
Testcase #18 | 145.322 ms | 11 MB + 836 KB | Accepted | Score: 4 | 显示更多 |
Testcase #19 | 177.064 ms | 13 MB + 788 KB | Accepted | Score: 4 | 显示更多 |
Testcase #20 | 400.377 ms | 17 MB + 968 KB | Accepted | Score: 4 | 显示更多 |
Testcase #21 | 179.423 ms | 13 MB + 408 KB | Accepted | Score: 4 | 显示更多 |
Testcase #22 | 161.98 ms | 2 MB + 236 KB | Accepted | Score: 4 | 显示更多 |
Testcase #23 | 171.184 ms | 6 MB + 148 KB | Accepted | Score: 4 | 显示更多 |
Testcase #24 | 173.008 ms | 2 MB + 376 KB | Accepted | Score: 4 | 显示更多 |
Testcase #25 | 273.453 ms | 19 MB + 596 KB | Accepted | Score: 4 | 显示更多 |