#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
int n, q;
cin >> n >> q;
vector <int> a(n+3);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
while (q--) {
int type;
cin >> type;
if (type == 1) {
int i, j;
cin >> i >> j;
a[i] = j;
}
else if (type == 2) {
int l, r;
cin >> l >> r;
int main = 0;
for (int i = l; i <= r; i++) {
int x = (i - l + 1) * (r - i + 1);
if (x % 2 == 1) {
main ^= a[i];
}
}
cout << main << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 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 |
2 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Correct |
2 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 |
296 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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
12 ms |
440 KB |
Output is correct |
12 |
Correct |
12 ms |
468 KB |
Output is correct |
13 |
Correct |
28 ms |
452 KB |
Output is correct |
14 |
Correct |
28 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
4404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
12 ms |
440 KB |
Output is correct |
12 |
Correct |
12 ms |
468 KB |
Output is correct |
13 |
Correct |
28 ms |
452 KB |
Output is correct |
14 |
Correct |
28 ms |
464 KB |
Output is correct |
15 |
Execution timed out |
1085 ms |
4404 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |