Submission #993101

#TimeUsernameProblemLanguageResultExecution timeMemory
993101MardonbekhazratovIntergalactic ship (IZhO19_xorsum)C++17
17 / 100
2082 ms1624 KiB
#include<bits/stdc++.h> using namespace std; const int MOD=1e9+7; signed main(){ int n; cin>>n; vector<int>a(n); for(int i=0;i<n;i++) cin>>a[i]; int q; cin>>q; vector<array<int,3>>queries(q); long long ans=0; for(int i=0;i<q;i++){ cin>>queries[i][0]>>queries[i][1]>>queries[i][2]; } for(int mask=0;mask<(1<<q);mask++){ vector<int>b=a; for(int i=0;i<q;i++){ if(mask>>i & 1){ for(int j=queries[i][0]-1;j<queries[i][1];j++) b[j]^=queries[i][2]; } } for(int i=0;i<n;i++){ long long s=0; for(int j=i;j<n;j++){ s+=b[j]; ans+=s*s; ans%=MOD; } } } cout<<ans; }
#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...