#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int a[N];
long long p[N];
int n;
void update() {
int pos, val;
cin >> pos >> val;
a[pos] = val;
p[1] = a[1];
for (int i = 2; i <= n; i++) p[i] = p[i - 2] ^ a[i];
}
void query() {
int l, r;
cin >> l >> r;
if ((r - l + 1) % 2 == 0) cout << 0 << '\n';
else {
cout << (p[r] ^ p[l] ^ a[l]) << '\n';
}
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int q;
cin >> n >> q;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (i == 1) p[i] = a[i];
else p[i] = p[i - 2] ^ a[i];
}
for (int _ = 0; _ < q; _++) {
int t;
cin >> t;
if (t == 1) update();
else query();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
22 ms |
376 KB |
Output is correct |
12 |
Correct |
23 ms |
400 KB |
Output is correct |
13 |
Correct |
7 ms |
332 KB |
Output is correct |
14 |
Correct |
7 ms |
396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
133 ms |
6556 KB |
Output is correct |
2 |
Correct |
126 ms |
8652 KB |
Output is correct |
3 |
Correct |
128 ms |
8704 KB |
Output is correct |
4 |
Correct |
111 ms |
8264 KB |
Output is correct |
5 |
Correct |
114 ms |
8440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
22 ms |
376 KB |
Output is correct |
12 |
Correct |
23 ms |
400 KB |
Output is correct |
13 |
Correct |
7 ms |
332 KB |
Output is correct |
14 |
Correct |
7 ms |
396 KB |
Output is correct |
15 |
Correct |
133 ms |
6556 KB |
Output is correct |
16 |
Correct |
126 ms |
8652 KB |
Output is correct |
17 |
Correct |
128 ms |
8704 KB |
Output is correct |
18 |
Correct |
111 ms |
8264 KB |
Output is correct |
19 |
Correct |
114 ms |
8440 KB |
Output is correct |
20 |
Execution timed out |
1081 ms |
4928 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |