Submission #905737

#TimeUsernameProblemLanguageResultExecution timeMemory
905737vjudge1Intergalactic ship (IZhO19_xorsum)C++17
0 / 100
2025 ms2648 KiB
#include <bits/stdc++.h> using namespace std; #define int long long long double rnd(){return (long double)(rand()/RAND_MAX);} main(){ srand(time(NULL)); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; int a[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]; } int q; cin>>q; int l[q+1],r[q+1],x[q+1]; for(int i=1;i<=q;i++){ cin>>l[i]>>r[i]>>x[i]; } int to=0; for(int j=0;j<(1<<q);j++){ int b[n+1]; for(int i=1;i<=n;i++){ b[i]=a[i]; } for(int i=0;i<q;i++){ if((j>>i)&1){ for(int j=l[i+1];j<=r[i+1];j++){ b[j]^=x[i+1]; } } } int ans=0; for(int i=1;i<=n;i++){ int sum=0; for(int j=i;j<=n;j++){ sum+=a[j]; sum%=1000000007; ans+=sum*sum; ans%=1000000007; } } to+=ans; to%=1000000007; } cout<<to<<endl; }

Compilation message (stderr)

xorsum.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
#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...