#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define FF first
#define SS second
#define all(a) a.begin(), a.end()
#define mod (ll)(1000000007)
const int pr=18, s_p=1<<pr, e_p=(1<<(pr+1))-1;
int n, q;
int S[2][1<<(pr+1)];
void update(int par, int ind, int new_){
S[par][ind]=new_;
S[!par][ind]=0;
while(ind/=2){
S[par][ind]=S[par][ind*2]^S[par][ind*2+1];
S[!par][ind]=S[!par][ind*2]^S[!par][ind*2+1];
}
}
int get(int id, int u, int v, int l, int r, int par){
if(l>v || r<u)
return 0;
if(l>=u && r<=v)
return S[par][id];
int md=(l+r)/2;
return get(id*2, u, v, l, md, par)^get(id*2+1, u, v, md+1, r, par);
}
int main(){
cin>>n>>q;
for(int i=1, a;i<=n;i++){
cin>>a;
update(i&1, i+s_p, a);
}
while(q--){
int type, i, x;
cin>>type>>i>>x;
if(type==1){
for(int j=0;j<=29;j++){
update(i&1, i+s_p, x);
}
}
else if(type==2){
int ans=0;
if((x-i+1)&1)
ans=get(1, i+s_p, x+s_p, s_p, e_p, i&1);
cout<<ans<<endl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
14 ms |
340 KB |
Output is correct |
12 |
Correct |
14 ms |
340 KB |
Output is correct |
13 |
Correct |
11 ms |
468 KB |
Output is correct |
14 |
Correct |
13 ms |
480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
424 ms |
4760 KB |
Output is correct |
2 |
Correct |
420 ms |
9520 KB |
Output is correct |
3 |
Correct |
420 ms |
9412 KB |
Output is correct |
4 |
Correct |
411 ms |
9120 KB |
Output is correct |
5 |
Correct |
408 ms |
9180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
292 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
14 ms |
340 KB |
Output is correct |
12 |
Correct |
14 ms |
340 KB |
Output is correct |
13 |
Correct |
11 ms |
468 KB |
Output is correct |
14 |
Correct |
13 ms |
480 KB |
Output is correct |
15 |
Correct |
424 ms |
4760 KB |
Output is correct |
16 |
Correct |
420 ms |
9520 KB |
Output is correct |
17 |
Correct |
420 ms |
9412 KB |
Output is correct |
18 |
Correct |
411 ms |
9120 KB |
Output is correct |
19 |
Correct |
408 ms |
9180 KB |
Output is correct |
20 |
Correct |
561 ms |
9212 KB |
Output is correct |
21 |
Correct |
571 ms |
9240 KB |
Output is correct |
22 |
Correct |
550 ms |
9276 KB |
Output is correct |
23 |
Correct |
419 ms |
9076 KB |
Output is correct |
24 |
Correct |
424 ms |
9076 KB |
Output is correct |