Submission #746564

#TimeUsernameProblemLanguageResultExecution timeMemory
746564Elvin_FritlXORanges (eJOI19_xoranges)C++17
0 / 100
479 ms6884 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n,q; cin>>n>>q; vector<int>a(n+1),pre(n+1,0),pre2(n+1,0); for(int i=1;i<=n;i++){ cin>>a[i]; if(i&1){ pre[i]=(pre[i-1]^a[i]); pre2[i]=pre2[i-1]; } else{ pre2[i]=(pre2[i-1]^a[i]); pre[i]=pre[i-1]; } } while(q--){ int ind,l,r; cin>>ind>>l>>r; if(ind==2){ if(l&1){ cout<<(pre[r]^pre[l-1])<<"\n"; } else{ cout<<(pre2[r]^pre2[l-1])<<"\n"; } } else{ a[l]=r; if(l&1){ for(int i=l;i<=n;i++){ if(i&1){ pre[i]=(pre[i-1]^a[i]); } else{ pre[i]=pre[i-1]; } } } else{ for(int i=l;i<=n;i++){ if(i&1){ pre2[i]=pre2[i-1]; } else{ pre2[i]=(pre2[i-1]^a[i]); } } } } } 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...