Submission #832122

#TimeUsernameProblemLanguageResultExecution timeMemory
832122KaleemRazaSyedXORanges (eJOI19_xoranges)C++17
0 / 100
613 ms7900 KiB
#include<iostream> using namespace std; const int MAXN = 2e5+5, MAXQ = 1e3; struct chunk { int a[MAXN], ch[MAXQ]; void add(int x, int i) { ch[i/MAXQ]^=a[i]^x; a[i] = x; } int Xor(int i, int j) { int ans = 0; while(i <= j) { if(i%MAXQ==0 and MAXQ <= j-i+1) { ans ^= ch[i/MAXQ]; i += MAXQ; } else ans ^= a[i++]; } return ans; } }; chunk chunks[2]; int main() { int n, q; cin >> n >> q; for(int i=0;i<n;i++) { int x; cin >> x; chunks[i%2].add(x, i/2); } while(q--) { int t, i, j; cin >> t >> i >> j; i--; if(t==1) chunks[i%2].add(j, i/2); else cout << chunks[i%2].Xor(i/2, (j-1)/2) << endl; } 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...