# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
286976 | tqbfjotld | Intergalactic ship (IZhO19_xorsum) | C++14 | 2050 ms | 1536 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;
///why not grab subtask
int orig[1005];
int l[100005];
int r[100005];
int v[100005];
int newv[1005];
int main(){
int n;
scanf("%d",&n);
for (int x = 1; x<=n; x++){
scanf("%d",&orig[x]);
}
int q;
scanf("%d",&q);
for (int x = 0; x<q; x++){
scanf("%d%d%d",&l[x],&r[x],&v[x]);
}
long long ans = 0;
for (int bitmask = 0; bitmask<(1<<q); bitmask++){
for (int x = 1; x<=n; x++){
newv[x] = orig[x];
}
for (int x = 0; x<q; x++){
if (bitmask & (1<<x)){
for (int y = l[x]; y<=r[x]; y++){
newv[y] ^= v[x];
}
}
}
long long something = 0;
long long tans = 0;
for (int x = 1; x<=n; x++){
tans += newv[x]*newv[x]*x*(n-x+1);
tans += 2*newv[x]*(n-x+1)*something;
tans %= 1000000007LL;
something += newv[x]*x;
something %= 1000000007LL;
}
ans += tans;
ans %= 1000000007LL;
}
printf("%lld",ans);
}
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... |