#include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <iterator>
#include <vector>
#define ff first
#define ss second
#define mp make_pair
#define ll long long
using namespace std;
int main() {
int n, q;
cin >> n >> q;
int a[n];
for (int i = 0; i < n; i++){
cin >> a[i];
}
if (n <= 5000 && q <= 5000){
for (int lol = 0; lol < q; lol++){
int x, y, z;
cin >> x >> y >> z;
if (x == 1) {a[y - 1] = z;}
else {
if (z - y % 2 == 1) {cout << "0" << endl; continue;}
int p = a[y - 1];
for (int i = y + 1; i < z; i = i + 2){
p = (p ^ a[i]);
}
cout << p << endl;
}
}
} else {
int b[n];
b[0] = a[0]; b[1] = b[1];
for (int i = 2; i < n; i++){
b[i] = (b[i - 2] ^ a[i]);
}
for (int lol = 0; lol < q; lol++){
int x, y, z;
cin >> x >> y >> z;
if (x == 1) {a[y - 1] = z;}
else {
if (z - y % 2 == 1) {cout << "0" << endl; continue;}
int p = ((b[z - 1] ^ b[y - 1]) ^ a[y - 1]);
cout << p << endl;
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
430 ms |
3812 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |