Submission #1062350

#TimeUsernameProblemLanguageResultExecution timeMemory
106235012345678Intergalactic ship (IZhO19_xorsum)C++17
17 / 100
407 ms604 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int nx=105, mod=1e9+7; ll n, q, a[nx], t[nx], qs[nx], l[nx], r[nx], x[nx], res; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) cin>>a[i]; cin>>q; for (int i=0; i<q; i++) cin>>l[i]>>r[i]>>x[i]; for (int msk=0; msk<(1<<q); msk++) { ll sm=0; for (int i=1; i<=n; i++) t[i]=a[i]; for (int i=0; i<q;i ++) if (msk&(1<<i)) for (int j=l[i]; j<=r[i]; j++) t[j]=t[j]^x[i]; for (int i=1; i<=n; i++) qs[i]=(qs[i-1]+t[i])%mod, res=(res+(((n)*qs[i])%mod*(qs[i]))%mod), sm+=qs[i]; sm=(sm*sm%mod); sm=((-sm)%mod+mod)%mod; for (int i=1; i<=n; i++) sm=(sm+qs[i]*qs[i])%mod; res=(res+sm)%mod; } cout<<res; }
#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...