Submission #173240

#TimeUsernameProblemLanguageResultExecution timeMemory
173240mosiashvililukaIntergalactic ship (IZhO19_xorsum)C++14
9 / 100
100 ms1272 KiB
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,e,f[1009],i,j,zx,xc,xr[(1<<10)][101],pas,mod=1000000007; pair <pair <long long, long long>, long long> 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; } if(b<=10){ 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]); pas%=mod; } } } 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...