# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
651195 | 2022-10-18T02:26:07 Z | BrineTw | Intergalactic ship (IZhO19_xorsum) | C++14 | 2000 ms | 2212 KB |
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; struct Update { int l, r, x; }; int mAdd(const int a, const int b) { if (a + b >= M) return a + b - M; if (a + b < 0) return a + b + M; return a + b; } int calculate(vector<int> v, vector<Update>& update, int i) { int sum = 0; for (int j = 0; i; j++, i >>= 1) { if (i & 1) { for (int k = update[j].l; k < update[j].r; k++) { v[k] ^= update[j].x; } } } for (int i = 0; i < v.size(); i++) { int currentTotal = 0; for (int j = i; j < v.size(); j++) { currentTotal += v[j]; sum = mAdd(sum, currentTotal * currentTotal % M); } } return sum; } int main() { int length; cin >> length; vector<int> v(length); for (auto& n: v) cin >> n; int query; cin >> query; vector<Update> update(query); for (auto& [l, r, x]: update) { cin >> l >> r >> x; --l; } int sum = 0; for (int i = 0; i < (1 << query); i++) { sum = mAdd(sum, calculate(v, update, i)); } cout << sum << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 13 ms | 300 KB | Output is correct |
7 | Correct | 16 ms | 300 KB | Output is correct |
8 | Correct | 14 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 61 ms | 2212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2073 ms | 212 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1425 ms | 280 KB | Output is correct |
2 | Correct | 1467 ms | 280 KB | Output is correct |
3 | Correct | 1524 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1425 ms | 280 KB | Output is correct |
2 | Correct | 1467 ms | 280 KB | Output is correct |
3 | Correct | 1524 ms | 292 KB | Output is correct |
4 | Incorrect | 3 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 13 ms | 300 KB | Output is correct |
7 | Correct | 16 ms | 300 KB | Output is correct |
8 | Correct | 14 ms | 300 KB | Output is correct |
9 | Correct | 1425 ms | 280 KB | Output is correct |
10 | Correct | 1467 ms | 280 KB | Output is correct |
11 | Correct | 1524 ms | 292 KB | Output is correct |
12 | Incorrect | 59 ms | 296 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 13 ms | 300 KB | Output is correct |
7 | Correct | 16 ms | 300 KB | Output is correct |
8 | Correct | 14 ms | 300 KB | Output is correct |
9 | Correct | 1425 ms | 280 KB | Output is correct |
10 | Correct | 1467 ms | 280 KB | Output is correct |
11 | Correct | 1524 ms | 292 KB | Output is correct |
12 | Incorrect | 3 ms | 340 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 13 ms | 300 KB | Output is correct |
7 | Correct | 16 ms | 300 KB | Output is correct |
8 | Correct | 14 ms | 300 KB | Output is correct |
9 | Incorrect | 61 ms | 2212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |