Submission #956497

#TimeUsernameProblemLanguageResultExecution timeMemory
956497Darren0724Intergalactic ship (IZhO19_xorsum)C++17
0 / 100
2061 ms2640 KiB
#include <bits/stdc++.h> using namespace std; #define LCBorz ios_base::sync_with_stdio(false); cin.tie(0); #define int long long #define all(x) x.begin(), x.end() #define endl '\n' const int N=200005; const int INF=1e18; const int mod=1e9+7; int n,ans=0; vector<int> v(N); void cal(){ int total=0; for(int mask=0;mask<(1<<n);mask++){ int cnt=0; for(int j=1;j<=n;j++){ if(mask&(1<<(j-1))){ cnt+=v[j]; } } total+=cnt*cnt; total%=mod; } ans=(ans+total)%mod; } int32_t main() { LCBorz; cin>>n; for(int i=1;i<=n;i++){ cin>>v[i]; } cal(); int q;cin>>q; for(int i=0;i<q;i++){ int a,b,c;cin>>a>>b>>c; for(int j=a;j<=b;j++){ v[j]^=c; } cal(); } cout<<ans<<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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...