#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
const int N = (int)3e5+10;
int n, q, x, fen[2][N];
void upd(int x, int v){
x++; int t = x%2;
for(; x < N; x+=x&-x) fen[t][x]^=v;
}
int sum(int x){
x++; int s = 0, t = x%2;
for(; x>0; x-=x&-x) s^=fen[t][x];
return s;
}
int main(){
cin >> n >> q;
for(int i = 1; i <= n; i++) cin >> x, upd(i,x);
while(q--){
int t,v,l,r; cin >> t;
if(t==1) cin >> l >> v, upd(l,sum(l)^sum(l-2)), upd(l,v);
else cin >> l >> r,cout << (sum(r)^sum(l-1-(r%2==l%2))) << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2540 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
493 ms |
9296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |