Submission #173238

#TimeUsernameProblemLanguageResultExecution timeMemory
173238mosiashvililukaIntergalactic ship (IZhO19_xorsum)C++14
0 / 100
26 ms1572 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,f[1009],i,j,zx,xc,xr[(1<<10)][101],pas; pair <pair <int, int>, int> p[1009]; int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a; for(i=1; i<=a; i++) cin>>f[i]; cin>>b; for(i=0; i<b; i++){ cin>>p[i].first.first>>p[i].first.second>>p[i].second; } for(j=1; j<=a; j++) xr[0][j]=f[j]; for(i=1; i<(1<<b); i++){ for(zx=b-1; zx>=0; zx--){ if((i&(1<<zx))!=0) break; } for(j=1; j<=a; j++){ if(p[zx].first.first<=j&&j<=p[zx].first.second){ xr[i][j]=(xr[i-(1<<zx)][j]^p[zx].second); }else{ xr[i][j]=xr[i-(1<<zx)][j]; } } } for(i=0; i<(1<<b); i++){ for(j=1; j<=a; j++) xr[i][j]+=xr[i][j-1]; for(zx=1; zx<=a; zx++){ for(xc=zx-1; xc>=0; xc--){ pas+=(xr[i][xc]-xr[i][zx])*(xr[i][xc]-xr[i][zx]); } } } cout<<pas; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...