Submission #260066

#TimeUsernameProblemLanguageResultExecution timeMemory
260066mosiashvililukaXORanges (eJOI19_xoranges)C++14
100 / 100
585 ms7964 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,fen[100009][2],tes,t,tp,f[200009]; void upd(int q, int w, int rr){ while(q<=100000){ fen[q][w]^=rr; q=q+(q&(-q)); } } int read(int q, int w){ int jm=0; while(q>=1){ jm^=fen[q][w]; q=q-(q&(-q)); } return jm; } int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a>>tes; for(i=1; i<=a; i++){ cin>>f[i]; upd(i/2+i%2,i%2,f[i]); } for(t=1; t<=tes; t++){ cin>>tp>>c>>d; if(tp==1){ upd(c/2+c%2,c%2,(f[c]^d)); f[c]=d; }else{ if((d-c+1)%2==0){ cout<<0<<endl; continue; } e=c%2; c-=2; cout<<(read(d/2+d%2,e)^read(c/2+c%2,e))<<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...