# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
903927 | 2024-01-11T14:44:17 Z | LucaLucaM | Intergalactic ship (IZhO19_xorsum) | C++17 | 2000 ms | 3420 KB |
#include <iostream> #include <vector> #include <algorithm> #include <cassert> #include <cstring> #warning That's the baby, that's not my baby #define int long long typedef long long ll; const int mod = 1e9 + 7; struct Update { int l, r, x; }; int power(int a, int b) { int p = 1; while (b) { if (b & 1) { p = (ll) p * a % mod; } a = (ll) a * a % mod; b >>= 1; } return p; } int solve(std::vector<int> a) { int n = (int) a.size(); ll ret = 0; for (int i = 0; i < n; i++) { int s = 0; for (int j = i; j < n; j++) { s += a[j]; ret += s * s; } } return ret % mod; } signed main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); int n; std::cin >> n; std::vector<int> a(n); for (auto &x : a) { std::cin >> x; } int q; std::cin >> q; std::vector<Update> Q(q); for (auto &[l, r, x] : Q) { std::cin >> l >> r >> x; --l, --r; } ll answer = 0; for (int mask = 0; mask < (1 << q); mask++) { std::vector<int> b = a; for (int i = 0; i < q; i++) { if (mask & (1 << i)) { for (int k = Q[i].l; k <= Q[i].r; k++) { b[k] ^= Q[i].x; } } } answer += solve(b); } std::cout << answer % mod; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 352 KB | Output is correct |
4 | Correct | 0 ms | 456 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 352 KB | Output is correct |
4 | Correct | 0 ms | 456 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 8 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 5 ms | 496 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 3420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2029 ms | 352 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 570 ms | 432 KB | Output is correct |
2 | Correct | 606 ms | 432 KB | Output is correct |
3 | Correct | 561 ms | 428 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 570 ms | 432 KB | Output is correct |
2 | Correct | 606 ms | 432 KB | Output is correct |
3 | Correct | 561 ms | 428 KB | Output is correct |
4 | Incorrect | 5 ms | 604 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 352 KB | Output is correct |
4 | Correct | 0 ms | 456 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 8 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 5 ms | 496 KB | Output is correct |
9 | Correct | 570 ms | 432 KB | Output is correct |
10 | Correct | 606 ms | 432 KB | Output is correct |
11 | Correct | 561 ms | 428 KB | Output is correct |
12 | Incorrect | 27 ms | 348 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 352 KB | Output is correct |
4 | Correct | 0 ms | 456 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 8 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 5 ms | 496 KB | Output is correct |
9 | Correct | 570 ms | 432 KB | Output is correct |
10 | Correct | 606 ms | 432 KB | Output is correct |
11 | Correct | 561 ms | 428 KB | Output is correct |
12 | Incorrect | 5 ms | 604 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 352 KB | Output is correct |
4 | Correct | 0 ms | 456 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 8 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 5 ms | 496 KB | Output is correct |
9 | Incorrect | 17 ms | 3420 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |