# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
905788 | Der_Vlapos | Intergalactic ship (IZhO19_xorsum) | C++17 | 2041 ms | 2652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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];
ans+=sum*sum;
}
ans%=1000000007;
}
to+=ans;
to%=1000000007;
}
cout<<to<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |