#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];
}
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--;
int ans=0;
for(int i = l;i<=r;i++){
int left = abs(l-i);
int right= abs(r-i);
int tot = n*(n+1)/2;
int nbLeft = (left)*(left+1)/2;
int nbRight = (right)*(right+1)/2;
int parity = (tot-nbLeft-nbRight)&1;
if(parity){
ans^=nums[i];
}
}
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 |
2 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 |
Execution timed out |
1056 ms |
2140 KB |
Time limit exceeded |
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 |
- |