#include <iostream>
using namespace std;
unsigned int o[200000], b1[100001], b2[100001];
unsigned int bxor(unsigned int b[100001], int i) {
i++; unsigned int res = 0;
while (i > 0) {
res ^= b[i];
i -= i & (-i);
}
return res;
}
void bchg(unsigned int b[100001], int n, int i, unsigned int c) {
i++; while (i <= n) {
b[i] ^= c;
i += i & (-i);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, q; cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> o[i];
bchg(i & 1 ? b2 : b1, n, i / 2, o[i]);
}
for (int it = 0; it < q; it++) {
int code; cin >> code;
if (code == 1) {
int i; unsigned int j; cin >> i >> j; i--;
bchg(i & 1 ? b2 : b1, n, i / 2, j ^ o[i]);
o[i] = j;
} else {
int l, u; cin >> l >> u;
if (!((u - l + 1) & 1)) {
cout << 0 << endl;
continue;
}
cout << (bxor(l & 1 ? b1 : b2, l / 2 - 1) ^ bxor(l & 1 ? b1 : b2, u / 2)) << endl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
271 ms |
7484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |