Submission #336369

#TimeUsernameProblemLanguageResultExecution timeMemory
336369juggernautIntergalactic ship (IZhO19_xorsum)C++14
9 / 100
2080 ms492 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,a[105],pref[105],q,l[15],r[15],val[15],mod=1e9+7; void _xor(int mask){ for(int i=0;i<q;i++)if(mask&(1<<i))for(int pos=l[i+1];pos<=r[i+1];pos++)a[pos]^=val[i+1]; } ll sq(ll x){return (x*x)%mod;} ll go(int mask){ _xor(mask); ll res=0; for(int i=1;i<=n;i++)pref[i]=pref[i-1]+a[i]; for(int i=1;i<=n;i++) for(int j=1;j<=i;j++) res=(res+sq(pref[i]-pref[j-1]))%mod; _xor(mask); return res; } int main(){ scanf("%lld",&n); for(int i=1;i<=n;i++)scanf("%lld",&a[i]); scanf("%lld",&q); for(int i=1;i<=q;i++)scanf("%lld%lld%lld",&l[i],&r[i],&val[i]); ll ans=go(0); for(int mask=1;mask<(1<<q);mask++)ans=(ans+go(mask))%mod; cout<<ans; }

Compilation message (stderr)

xorsum.cpp: In function 'int main()':
xorsum.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   20 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
xorsum.cpp:21:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |     for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
      |                          ~~~~~^~~~~~~~~~~~~~
xorsum.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |     scanf("%lld",&q);
      |     ~~~~~^~~~~~~~~~~
xorsum.cpp:23:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |     for(int i=1;i<=q;i++)scanf("%lld%lld%lld",&l[i],&r[i],&val[i]);
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...