#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n';
const int M = 2e6+5, MOD = 1e9;
int fia[M], fib[M], v[M];
void zor(int pos, int val) {
for (int i = pos; i < M; i += -i&i) fia[i] ^= val;
}
int zum(int pos) {
int ans = 0;
for (int i = pos; i > 0; i -= -i&i) ans ^= fia[i];
return ans;
}
void zur(int pos, int val) {
for (int i = pos; i < M; i += -i&i) fib[i] ^= val;
}
int xum(int pos) {
int ans = 0;
for (int i = pos; i > 0; i -= -i&i) ans ^= fib[i];
return ans;
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int n, t;
cin >> n >> t;
for (int i = 1; i <= n; i++) {
cin >> v[i];
if (i%2) zor(i, v[i]);
else zur(i, v[i]);
}
while (t--) {
int x;
cin >> x;
if (x == 1) {
int a, b;
cin >> a >> b;
if (a%2) zor(a, (b^v[a]));
else zur(a, (b^v[a]));
v[a] = b;
} else {
int l, r;
cin >> l >> r;
if ((r-l)%2) {cout << 0 << endl;}
else if (l%2) {cout << (zum(r)^zum(l-1)) << endl;}
else cout << (xum(r)^xum(l-1)) << endl;
}
}
return 0;
}
/**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
452 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
464 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
452 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
460 KB |
Output is correct |
9 |
Correct |
1 ms |
464 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
3 ms |
596 KB |
Output is correct |
12 |
Correct |
3 ms |
596 KB |
Output is correct |
13 |
Correct |
4 ms |
656 KB |
Output is correct |
14 |
Correct |
3 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
101 ms |
11056 KB |
Output is correct |
2 |
Correct |
91 ms |
11032 KB |
Output is correct |
3 |
Correct |
95 ms |
11028 KB |
Output is correct |
4 |
Correct |
81 ms |
10720 KB |
Output is correct |
5 |
Correct |
82 ms |
10808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
452 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
460 KB |
Output is correct |
9 |
Correct |
1 ms |
464 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
3 ms |
596 KB |
Output is correct |
12 |
Correct |
3 ms |
596 KB |
Output is correct |
13 |
Correct |
4 ms |
656 KB |
Output is correct |
14 |
Correct |
3 ms |
596 KB |
Output is correct |
15 |
Correct |
101 ms |
11056 KB |
Output is correct |
16 |
Correct |
91 ms |
11032 KB |
Output is correct |
17 |
Correct |
95 ms |
11028 KB |
Output is correct |
18 |
Correct |
81 ms |
10720 KB |
Output is correct |
19 |
Correct |
82 ms |
10808 KB |
Output is correct |
20 |
Correct |
92 ms |
10964 KB |
Output is correct |
21 |
Correct |
96 ms |
10816 KB |
Output is correct |
22 |
Correct |
92 ms |
10772 KB |
Output is correct |
23 |
Correct |
81 ms |
10780 KB |
Output is correct |
24 |
Correct |
83 ms |
10756 KB |
Output is correct |