#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;cin>>n;
int q;cin>>q;
vector<int> nums(n);
for(int i = 0 ; i < n ; i++){
cin>>nums[i];
}
int XorPref[n][2];
for(int b=0;b<2;b++){
int act=0;
for(int i = 0;i<n;i++){
if((i&1)==b)act^=nums[i];
XorPref[i][b]=act;
}
}
for(int _=0;_<q;_++){
int type;cin>>type;
if(type==1){
int pos;cin>>pos;pos--;
int val;cin>>val;
nums[pos]=val;
}else{
int l,r;cin>>l>>r;
l--;r--;
if(((r-l)&1)){
cout<<0<<endl;
}else{
if(l==0){
int ans = XorPref[r][r%2];
cout<<ans<<endl;
}else{
int ans = XorPref[r][r%2]-XorPref[l-1][r%2];
cout<<ans<<endl;
}
}
}
}
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 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
384 ms |
6176 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |