#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,q;
cin >> n >> q;
long long values[n+2];
long long temp;
values[0] = 0;
values[1] = 0;
for(int i = 0; i < n; i++){
cin >> temp;
values[i+2] = temp ^ values[i];
}
for(int i = 0; i < q; i++){
int typ;
cin >> typ;
if(typ==2){
int a,b;
cin >> a >> b;
if((b-a) % 2 == 0){
cout << (values[a-1] ^ values[b+1]) << '\n';
} else cout << "0\n";
} else {
int pos;
cin >> pos;
cin >> temp;
long long diff = (values[pos+1] ^ values[pos-1]) ^ temp;
for(int j = pos+1; j < n+2; j+=2){
values[j] = values[j] ^ diff;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
3 ms |
856 KB |
Output is correct |
12 |
Correct |
5 ms |
604 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
66 ms |
8016 KB |
Output is correct |
2 |
Correct |
66 ms |
7824 KB |
Output is correct |
3 |
Correct |
60 ms |
8020 KB |
Output is correct |
4 |
Correct |
58 ms |
7504 KB |
Output is correct |
5 |
Correct |
56 ms |
7656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
3 ms |
856 KB |
Output is correct |
12 |
Correct |
5 ms |
604 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
66 ms |
8016 KB |
Output is correct |
16 |
Correct |
66 ms |
7824 KB |
Output is correct |
17 |
Correct |
60 ms |
8020 KB |
Output is correct |
18 |
Correct |
58 ms |
7504 KB |
Output is correct |
19 |
Correct |
56 ms |
7656 KB |
Output is correct |
20 |
Execution timed out |
1059 ms |
5476 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |