# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
382243 | 2021-03-26T19:37:26 Z | BartolM | Intergalactic ship (IZhO19_xorsum) | C++17 | 2000 ms | 3164 KB |
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; const int LOG=7; const int N=1005; const int MOD=1e9+7; const int Q=1e5+5; int add(int a, int b) { a+=b; if (a>=MOD) a-=MOD; return a; } int mul(int a, int b) { return (ll)a*b%MOD; } int n, q; int p[N], np[N]; vector <ppi> que; #define DEBUG 0 void solve() { int sol=0; for (int mask=0; mask<(1<<q); ++mask) { for (int i=0; i<n; ++i) np[i]=p[i]; for (int i=0; i<q; ++i) { if ((1<<i) & mask) { for (int j=que[i].X.X; j<=que[i].X.Y; ++j) np[j]=np[j]^que[i].Y; } } for (int i=0; i<n; ++i) { for (int j=i; j<n; ++j) { int interi=mul(i+1, n-j); if (i!=j) interi=mul(interi, 2); int curr=mul(np[i], np[j]); sol=add(sol, mul(curr, interi)); } } } printf("%d\n", sol); } void load() { scanf("%d", &n); for (int i=0; i<n; ++i) scanf("%d", p+i); scanf("%d", &q); for (int i=0; i<q; ++i) { int l, r, x; scanf("%d %d %d", &l, &r, &x); l--; r--; que.pb(mp(mp(l, r), x)); } } int main() { load(); assert(q<=20); // pot[0]=1; // for (int i=1; i<=q; ++i) pot[i]=mul(pot[i-1], 2); solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 29 ms | 364 KB | Output is correct |
7 | Correct | 29 ms | 380 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 29 ms | 3164 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 492 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 29 ms | 364 KB | Output is correct |
7 | Correct | 29 ms | 380 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
9 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 29 ms | 364 KB | Output is correct |
7 | Correct | 29 ms | 380 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
9 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 29 ms | 364 KB | Output is correct |
7 | Correct | 29 ms | 380 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
9 | Runtime error | 29 ms | 3164 KB | Execution killed with signal 6 |
10 | Halted | 0 ms | 0 KB | - |