#include<iostream>
using namespace std;
const int MAXN = 2e5+5, MAXQ = 1e3;
struct chunk
{
int a[MAXN], ch[MAXQ];
void add(int x, int i)
{
ch[i/MAXQ] ^= a[i]^x;
a[i] = x;
}
int Xor(int i, int j)
{
int ans = 0;
while(i <= j)
{
if(i%MAXQ==0 and MAXQ <= j-i+1)
{
ans ^= ch[i/MAXQ];
i += MAXQ;
}
else
ans ^= a[i++];
}
return ans;
}
};
chunk chunks[2];
int main()
{
int n, q;
cin >> n >> q;
for(int i=0;i<n;i++)
{
int x;
cin >> x;
chunks[i%2].add(x, i/2);
}
while(q--)
{
int t, i, j;
cin >> t >> i >> j;
i--;
if(t==1)
chunks[i%2].add(j, i/2);
else
{
if((j-i)&1)
cout << chunks[i%2].Xor(i/2, (j-1)/2) << endl;
else
cout << "0\n";
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
8 ms |
468 KB |
Output is correct |
12 |
Correct |
8 ms |
472 KB |
Output is correct |
13 |
Correct |
16 ms |
444 KB |
Output is correct |
14 |
Correct |
12 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
473 ms |
2276 KB |
Output is correct |
2 |
Correct |
464 ms |
7116 KB |
Output is correct |
3 |
Correct |
471 ms |
7132 KB |
Output is correct |
4 |
Correct |
503 ms |
6792 KB |
Output is correct |
5 |
Correct |
509 ms |
6676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
8 ms |
468 KB |
Output is correct |
12 |
Correct |
8 ms |
472 KB |
Output is correct |
13 |
Correct |
16 ms |
444 KB |
Output is correct |
14 |
Correct |
12 ms |
460 KB |
Output is correct |
15 |
Correct |
473 ms |
2276 KB |
Output is correct |
16 |
Correct |
464 ms |
7116 KB |
Output is correct |
17 |
Correct |
471 ms |
7132 KB |
Output is correct |
18 |
Correct |
503 ms |
6792 KB |
Output is correct |
19 |
Correct |
509 ms |
6676 KB |
Output is correct |
20 |
Correct |
327 ms |
6872 KB |
Output is correct |
21 |
Correct |
322 ms |
6892 KB |
Output is correct |
22 |
Correct |
394 ms |
6964 KB |
Output is correct |
23 |
Correct |
492 ms |
6876 KB |
Output is correct |
24 |
Correct |
487 ms |
6728 KB |
Output is correct |