#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int n, q, t1, t2;
vector<int> a;
string output;
cin >> n;
cin >> q;
a.reserve(n);
for (int i = 0; i < n; i++) {
cin >> t1;
a.push_back(t1);
}
for (int i = 0; i < q; i++) {
cin >> t1;
if (t1 == 1) {
cin >> t1;
cin >> t2;
a[t1-1] = t2;
}
else {
cin >> t1;
cin >> t2;
t1--;
vector<int> b(t2-t1, 0);
int res = 0;
for (int i = 1; i <= t2 - t1; i++) {
for (int j = t1; j < t2; j++) {
b[j - t1] += i;
if (j - i + 1 < t1) b[j - t1] -= abs(j - i + 1);
if (j + i - 1 > t2-1) b[j - t1] -= abs(j + i - t2);
}
}
for (int i = 0; i < (int)b.size(); i++) {
if (b[i] % 2) res = res ^ a[i + t1];
}
output.append(to_string(res) + "\n");
}
}
cout << output.substr(0, output.size()-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1098 ms |
1228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |