Submission #278179

#TimeUsernameProblemLanguageResultExecution timeMemory
278179EJOI2019AndrewXORanges (eJOI19_xoranges)C++14
55 / 100
1067 ms3504 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,q; cin>>n>>q; int a[n]; for(int i=0; i<n; ++i) cin>>a[i]; for(int i=0; i<q; ++i) { int type; cin>>type; if(type==1) { int pos,val; cin>>pos>>val; a[pos-1]=val; } else { int from,to; cin>>from>>to; --from; --to; int ans(0); for(int i=from; i<=to; ++i) { int freq=(i+1-from)*(to-from+1-i-from); if(freq%2) ans^=a[i]; } cout<<ans<<'\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...