Submission #1113940

#TimeUsernameProblemLanguageResultExecution timeMemory
1113940Dan4LifeXORanges (eJOI19_xoranges)C++17
100 / 100
482 ms8652 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) const int N = (int)3e5+10; int n, q, x, fen[2][N]; void upd(int x, int v){ x++; int t = x%2; for(; x < N; x+=x&-x) fen[t][x]^=v; } int sum(int x){ x++; int s = 0, t = x%2; for(; x>0; x-=x&-x) s^=fen[t][x]; return s; } int main(){ cin >> n >> q; for(int i = 1; i <= n; i++) cin >> x, upd(i,x); while(q--){ int t,v,l,r; cin >> t; if(t==1) cin >> l >> v, upd(l,sum(l)^sum(l-2)), upd(l,v); else cin >> l >> r,cout << ((r-l+1)%2==0?0:(sum(r)^sum(l-1-(r%2==l%2)))) << "\n"; } }
#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...