# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92825 | 2019-01-05T08:42:12 Z | SamAnd | Bootfall (IZhO17_bootfall) | C++17 | 200 ms | 263168 KB |
#include <bits/stdc++.h> using namespace std; const int N = 502; int n; int a[N]; int m; int u[N][N * N]; int main() { //freopen("input2.txt", "r", stdin); cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; m += a[i]; } u[0][0] = 1; for (int i = 1; i <= n; ++i) { for (int j = m; j >= 0; --j) { if (j + a[i] <= m) u[0][j + a[i]] += u[0][j]; } } for (int i = 1; i <= n; ++i) memcpy(u[i], u[0], sizeof u[0]); for (int i = 1; i <= n; ++i) { for (int j = 0; j <= m; ++j) { if (j + a[i] <= m) u[i][j + a[i]] -= u[i][j]; } } if ((m % 2) == 1 || !u[0][m / 2]) { cout << 0 << endl; return 0; } vector<int> ans; for (int x = 1; x <= m; ++x) { bool z = true; for (int i = 1; i <= n; ++i) { int y = (m - a[i] + x) / 2; if (!((m - a[i] + x) % 2 == 0 && y <= m && u[i][y])) { z = false; break; } } if (z) ans.push_back(x); } cout << ans.size() << endl; for (int i = 0; i < ans.size(); ++i) cout << ans[i] << ' '; cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 6264 KB | Output is correct |
3 | Correct | 4 ms | 3320 KB | Output is correct |
4 | Correct | 4 ms | 4348 KB | Output is correct |
5 | Correct | 11 ms | 12152 KB | Output is correct |
6 | Correct | 7 ms | 8188 KB | Output is correct |
7 | Correct | 6 ms | 6264 KB | Output is correct |
8 | Correct | 11 ms | 12152 KB | Output is correct |
9 | Correct | 8 ms | 10232 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 6264 KB | Output is correct |
3 | Correct | 4 ms | 3320 KB | Output is correct |
4 | Correct | 4 ms | 4348 KB | Output is correct |
5 | Correct | 11 ms | 12152 KB | Output is correct |
6 | Correct | 7 ms | 8188 KB | Output is correct |
7 | Correct | 6 ms | 6264 KB | Output is correct |
8 | Correct | 11 ms | 12152 KB | Output is correct |
9 | Correct | 8 ms | 10232 KB | Output is correct |
10 | Correct | 22 ms | 29944 KB | Output is correct |
11 | Correct | 22 ms | 29988 KB | Output is correct |
12 | Correct | 21 ms | 29944 KB | Output is correct |
13 | Correct | 19 ms | 25948 KB | Output is correct |
14 | Correct | 23 ms | 27896 KB | Output is correct |
15 | Correct | 24 ms | 27896 KB | Output is correct |
16 | Correct | 22 ms | 29944 KB | Output is correct |
17 | Correct | 13 ms | 18040 KB | Output is correct |
18 | Correct | 19 ms | 24060 KB | Output is correct |
19 | Correct | 19 ms | 26104 KB | Output is correct |
20 | Correct | 22 ms | 29944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 6264 KB | Output is correct |
3 | Correct | 4 ms | 3320 KB | Output is correct |
4 | Correct | 4 ms | 4348 KB | Output is correct |
5 | Correct | 11 ms | 12152 KB | Output is correct |
6 | Correct | 7 ms | 8188 KB | Output is correct |
7 | Correct | 6 ms | 6264 KB | Output is correct |
8 | Correct | 11 ms | 12152 KB | Output is correct |
9 | Correct | 8 ms | 10232 KB | Output is correct |
10 | Correct | 22 ms | 29944 KB | Output is correct |
11 | Correct | 22 ms | 29988 KB | Output is correct |
12 | Correct | 21 ms | 29944 KB | Output is correct |
13 | Correct | 19 ms | 25948 KB | Output is correct |
14 | Correct | 23 ms | 27896 KB | Output is correct |
15 | Correct | 24 ms | 27896 KB | Output is correct |
16 | Correct | 22 ms | 29944 KB | Output is correct |
17 | Correct | 13 ms | 18040 KB | Output is correct |
18 | Correct | 19 ms | 24060 KB | Output is correct |
19 | Correct | 19 ms | 26104 KB | Output is correct |
20 | Correct | 22 ms | 29944 KB | Output is correct |
21 | Correct | 45 ms | 63480 KB | Output is correct |
22 | Correct | 51 ms | 73348 KB | Output is correct |
23 | Correct | 36 ms | 49696 KB | Output is correct |
24 | Correct | 67 ms | 93176 KB | Output is correct |
25 | Correct | 74 ms | 93148 KB | Output is correct |
26 | Correct | 72 ms | 99056 KB | Output is correct |
27 | Correct | 85 ms | 99056 KB | Output is correct |
28 | Correct | 71 ms | 99064 KB | Output is correct |
29 | Correct | 73 ms | 99064 KB | Output is correct |
30 | Correct | 70 ms | 98936 KB | Output is correct |
31 | Correct | 71 ms | 99064 KB | Output is correct |
32 | Correct | 74 ms | 98936 KB | Output is correct |
33 | Correct | 70 ms | 99064 KB | Output is correct |
34 | Correct | 70 ms | 99064 KB | Output is correct |
35 | Correct | 70 ms | 98936 KB | Output is correct |
36 | Correct | 71 ms | 98956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 6264 KB | Output is correct |
3 | Correct | 4 ms | 3320 KB | Output is correct |
4 | Correct | 4 ms | 4348 KB | Output is correct |
5 | Correct | 11 ms | 12152 KB | Output is correct |
6 | Correct | 7 ms | 8188 KB | Output is correct |
7 | Correct | 6 ms | 6264 KB | Output is correct |
8 | Correct | 11 ms | 12152 KB | Output is correct |
9 | Correct | 8 ms | 10232 KB | Output is correct |
10 | Correct | 22 ms | 29944 KB | Output is correct |
11 | Correct | 22 ms | 29988 KB | Output is correct |
12 | Correct | 21 ms | 29944 KB | Output is correct |
13 | Correct | 19 ms | 25948 KB | Output is correct |
14 | Correct | 23 ms | 27896 KB | Output is correct |
15 | Correct | 24 ms | 27896 KB | Output is correct |
16 | Correct | 22 ms | 29944 KB | Output is correct |
17 | Correct | 13 ms | 18040 KB | Output is correct |
18 | Correct | 19 ms | 24060 KB | Output is correct |
19 | Correct | 19 ms | 26104 KB | Output is correct |
20 | Correct | 22 ms | 29944 KB | Output is correct |
21 | Correct | 45 ms | 63480 KB | Output is correct |
22 | Correct | 51 ms | 73348 KB | Output is correct |
23 | Correct | 36 ms | 49696 KB | Output is correct |
24 | Correct | 67 ms | 93176 KB | Output is correct |
25 | Correct | 74 ms | 93148 KB | Output is correct |
26 | Correct | 72 ms | 99056 KB | Output is correct |
27 | Correct | 85 ms | 99056 KB | Output is correct |
28 | Correct | 71 ms | 99064 KB | Output is correct |
29 | Correct | 73 ms | 99064 KB | Output is correct |
30 | Correct | 70 ms | 98936 KB | Output is correct |
31 | Correct | 71 ms | 99064 KB | Output is correct |
32 | Correct | 74 ms | 98936 KB | Output is correct |
33 | Correct | 70 ms | 99064 KB | Output is correct |
34 | Correct | 70 ms | 99064 KB | Output is correct |
35 | Correct | 70 ms | 98936 KB | Output is correct |
36 | Correct | 71 ms | 98956 KB | Output is correct |
37 | Correct | 155 ms | 197872 KB | Output is correct |
38 | Correct | 148 ms | 197892 KB | Output is correct |
39 | Correct | 192 ms | 245240 KB | Output is correct |
40 | Runtime error | 200 ms | 263168 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 6264 KB | Output is correct |
3 | Correct | 4 ms | 3320 KB | Output is correct |
4 | Correct | 4 ms | 4348 KB | Output is correct |
5 | Correct | 11 ms | 12152 KB | Output is correct |
6 | Correct | 7 ms | 8188 KB | Output is correct |
7 | Correct | 6 ms | 6264 KB | Output is correct |
8 | Correct | 11 ms | 12152 KB | Output is correct |
9 | Correct | 8 ms | 10232 KB | Output is correct |
10 | Correct | 22 ms | 29944 KB | Output is correct |
11 | Correct | 22 ms | 29988 KB | Output is correct |
12 | Correct | 21 ms | 29944 KB | Output is correct |
13 | Correct | 19 ms | 25948 KB | Output is correct |
14 | Correct | 23 ms | 27896 KB | Output is correct |
15 | Correct | 24 ms | 27896 KB | Output is correct |
16 | Correct | 22 ms | 29944 KB | Output is correct |
17 | Correct | 13 ms | 18040 KB | Output is correct |
18 | Correct | 19 ms | 24060 KB | Output is correct |
19 | Correct | 19 ms | 26104 KB | Output is correct |
20 | Correct | 22 ms | 29944 KB | Output is correct |
21 | Correct | 45 ms | 63480 KB | Output is correct |
22 | Correct | 51 ms | 73348 KB | Output is correct |
23 | Correct | 36 ms | 49696 KB | Output is correct |
24 | Correct | 67 ms | 93176 KB | Output is correct |
25 | Correct | 74 ms | 93148 KB | Output is correct |
26 | Correct | 72 ms | 99056 KB | Output is correct |
27 | Correct | 85 ms | 99056 KB | Output is correct |
28 | Correct | 71 ms | 99064 KB | Output is correct |
29 | Correct | 73 ms | 99064 KB | Output is correct |
30 | Correct | 70 ms | 98936 KB | Output is correct |
31 | Correct | 71 ms | 99064 KB | Output is correct |
32 | Correct | 74 ms | 98936 KB | Output is correct |
33 | Correct | 70 ms | 99064 KB | Output is correct |
34 | Correct | 70 ms | 99064 KB | Output is correct |
35 | Correct | 70 ms | 98936 KB | Output is correct |
36 | Correct | 71 ms | 98956 KB | Output is correct |
37 | Correct | 155 ms | 197872 KB | Output is correct |
38 | Correct | 148 ms | 197892 KB | Output is correct |
39 | Correct | 192 ms | 245240 KB | Output is correct |
40 | Runtime error | 200 ms | 263168 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4344 KB | Output is correct |
2 | Correct | 6 ms | 6264 KB | Output is correct |
3 | Correct | 4 ms | 3320 KB | Output is correct |
4 | Correct | 4 ms | 4348 KB | Output is correct |
5 | Correct | 11 ms | 12152 KB | Output is correct |
6 | Correct | 7 ms | 8188 KB | Output is correct |
7 | Correct | 6 ms | 6264 KB | Output is correct |
8 | Correct | 11 ms | 12152 KB | Output is correct |
9 | Correct | 8 ms | 10232 KB | Output is correct |
10 | Correct | 22 ms | 29944 KB | Output is correct |
11 | Correct | 22 ms | 29988 KB | Output is correct |
12 | Correct | 21 ms | 29944 KB | Output is correct |
13 | Correct | 19 ms | 25948 KB | Output is correct |
14 | Correct | 23 ms | 27896 KB | Output is correct |
15 | Correct | 24 ms | 27896 KB | Output is correct |
16 | Correct | 22 ms | 29944 KB | Output is correct |
17 | Correct | 13 ms | 18040 KB | Output is correct |
18 | Correct | 19 ms | 24060 KB | Output is correct |
19 | Correct | 19 ms | 26104 KB | Output is correct |
20 | Correct | 22 ms | 29944 KB | Output is correct |
21 | Correct | 45 ms | 63480 KB | Output is correct |
22 | Correct | 51 ms | 73348 KB | Output is correct |
23 | Correct | 36 ms | 49696 KB | Output is correct |
24 | Correct | 67 ms | 93176 KB | Output is correct |
25 | Correct | 74 ms | 93148 KB | Output is correct |
26 | Correct | 72 ms | 99056 KB | Output is correct |
27 | Correct | 85 ms | 99056 KB | Output is correct |
28 | Correct | 71 ms | 99064 KB | Output is correct |
29 | Correct | 73 ms | 99064 KB | Output is correct |
30 | Correct | 70 ms | 98936 KB | Output is correct |
31 | Correct | 71 ms | 99064 KB | Output is correct |
32 | Correct | 74 ms | 98936 KB | Output is correct |
33 | Correct | 70 ms | 99064 KB | Output is correct |
34 | Correct | 70 ms | 99064 KB | Output is correct |
35 | Correct | 70 ms | 98936 KB | Output is correct |
36 | Correct | 71 ms | 98956 KB | Output is correct |
37 | Correct | 155 ms | 197872 KB | Output is correct |
38 | Correct | 148 ms | 197892 KB | Output is correct |
39 | Correct | 192 ms | 245240 KB | Output is correct |
40 | Runtime error | 200 ms | 263168 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
41 | Halted | 0 ms | 0 KB | - |