#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,q;
cin >> n >> q;
vector<long long> a,p;
vector<long long> a2,p2;
a.push_back(0);a2.push_back(0);
p.push_back(0);p2.push_back(0);
for(long long i=1;i<=n;i++){
long long x;
cin >> x;
if(i%2==1){
a.push_back(x^a[i/2]);
p.push_back(x);
}
else{
a2.push_back(x^a2[i/2-1]);
p2.push_back(x);
}
}
while(q--){
long long action;
cin >> action;
if(action==1){
long long pos,ch;
cin >> pos >> ch;
if(pos%2!=0){
for(int i=1;i<=(n+1)/2;i++){
if(i==(pos+1)/2){
a[i]=a[i-1]^ch;
}
else if(i>(pos+1)/2){
a[i]=a[i-1]^p[i];
}
}
}
else {
for(int i=1;i<=n/2;i++){
if(i==pos/2){
a2[i]=a2[i-1]^ch;
}
else if(i>pos/2){
a2[i]=a2[i-1]^p2[i];
}
}
}
}
else{
long long l,u;
cin >> l >> u;
if((u-l)%2==1) cout << 0<<"\n";
else{
if(l%2==1){
long long xum =a[(u+1)/2]^a[l/2];
cout << xum <<"\n";
}
else{
long long xum=a2[u/2]^a2[(l/2)-1];
cout << xum <<"\n";
}
}
}
}
return 0;
}
# |
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 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
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 |
Correct |
391 ms |
9580 KB |
Output is correct |
2 |
Correct |
376 ms |
9504 KB |
Output is correct |
3 |
Correct |
428 ms |
9632 KB |
Output is correct |
4 |
Correct |
370 ms |
9184 KB |
Output is correct |
5 |
Correct |
366 ms |
9228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |