# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315306 | 2020-10-22T10:13:05 Z | dolphingarlic | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 760 KB |
#include <bits/stdc++.h> #pragma GCC Optimize("unroll-loops") using namespace std; int main() { int n, a[500], tot = 0; scanf("%d", &n); bitset<250001> base; base[0] = 1; for (int i = 0; i < n; i++) { scanf("%d", a + i); tot += a[i]; base |= base << a[i]; } if ((tot & 1) || !base[tot >> 1]) return printf("0"), 0; bitset<250001> ans; for (int i = 1; i < 250001; i++) ans[i] = 1; for (int i = 0; i < n; i++) { bitset<250001> possible, good; possible[0] = 1; for (int j = 0; j < n; j++) if (j != i) possible |= possible << a[j]; for (int j = 1; j < 250001; j++) good[j] = !(tot - a[i] + j & 1) && (tot - a[i] + j >> 1) >= j && possible[(tot - a[i] + j >> 1) - j]; ans &= good; } printf("%d\n", ans.count()); for (int i = 0; i < 250001; i++) if (ans[i]) printf("%d ", i); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 512 KB | Output is correct |
5 | Correct | 11 ms | 512 KB | Output is correct |
6 | Correct | 7 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 512 KB | Output is correct |
8 | Correct | 11 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 512 KB | Output is correct |
5 | Correct | 11 ms | 512 KB | Output is correct |
6 | Correct | 7 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 512 KB | Output is correct |
8 | Correct | 11 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 512 KB | Output is correct |
10 | Correct | 31 ms | 512 KB | Output is correct |
11 | Correct | 30 ms | 512 KB | Output is correct |
12 | Correct | 30 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 512 KB | Output is correct |
14 | Correct | 28 ms | 512 KB | Output is correct |
15 | Correct | 28 ms | 512 KB | Output is correct |
16 | Correct | 30 ms | 512 KB | Output is correct |
17 | Correct | 17 ms | 512 KB | Output is correct |
18 | Correct | 23 ms | 512 KB | Output is correct |
19 | Correct | 25 ms | 512 KB | Output is correct |
20 | Correct | 30 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 512 KB | Output is correct |
5 | Correct | 11 ms | 512 KB | Output is correct |
6 | Correct | 7 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 512 KB | Output is correct |
8 | Correct | 11 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 512 KB | Output is correct |
10 | Correct | 31 ms | 512 KB | Output is correct |
11 | Correct | 30 ms | 512 KB | Output is correct |
12 | Correct | 30 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 512 KB | Output is correct |
14 | Correct | 28 ms | 512 KB | Output is correct |
15 | Correct | 28 ms | 512 KB | Output is correct |
16 | Correct | 30 ms | 512 KB | Output is correct |
17 | Correct | 17 ms | 512 KB | Output is correct |
18 | Correct | 23 ms | 512 KB | Output is correct |
19 | Correct | 25 ms | 512 KB | Output is correct |
20 | Correct | 30 ms | 512 KB | Output is correct |
21 | Correct | 85 ms | 512 KB | Output is correct |
22 | Correct | 105 ms | 512 KB | Output is correct |
23 | Correct | 61 ms | 512 KB | Output is correct |
24 | Correct | 153 ms | 636 KB | Output is correct |
25 | Correct | 154 ms | 512 KB | Output is correct |
26 | Correct | 167 ms | 632 KB | Output is correct |
27 | Correct | 169 ms | 512 KB | Output is correct |
28 | Correct | 169 ms | 632 KB | Output is correct |
29 | Correct | 169 ms | 512 KB | Output is correct |
30 | Correct | 170 ms | 512 KB | Output is correct |
31 | Correct | 167 ms | 636 KB | Output is correct |
32 | Correct | 172 ms | 544 KB | Output is correct |
33 | Correct | 166 ms | 512 KB | Output is correct |
34 | Correct | 168 ms | 632 KB | Output is correct |
35 | Correct | 167 ms | 512 KB | Output is correct |
36 | Correct | 168 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 512 KB | Output is correct |
5 | Correct | 11 ms | 512 KB | Output is correct |
6 | Correct | 7 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 512 KB | Output is correct |
8 | Correct | 11 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 512 KB | Output is correct |
10 | Correct | 31 ms | 512 KB | Output is correct |
11 | Correct | 30 ms | 512 KB | Output is correct |
12 | Correct | 30 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 512 KB | Output is correct |
14 | Correct | 28 ms | 512 KB | Output is correct |
15 | Correct | 28 ms | 512 KB | Output is correct |
16 | Correct | 30 ms | 512 KB | Output is correct |
17 | Correct | 17 ms | 512 KB | Output is correct |
18 | Correct | 23 ms | 512 KB | Output is correct |
19 | Correct | 25 ms | 512 KB | Output is correct |
20 | Correct | 30 ms | 512 KB | Output is correct |
21 | Correct | 85 ms | 512 KB | Output is correct |
22 | Correct | 105 ms | 512 KB | Output is correct |
23 | Correct | 61 ms | 512 KB | Output is correct |
24 | Correct | 153 ms | 636 KB | Output is correct |
25 | Correct | 154 ms | 512 KB | Output is correct |
26 | Correct | 167 ms | 632 KB | Output is correct |
27 | Correct | 169 ms | 512 KB | Output is correct |
28 | Correct | 169 ms | 632 KB | Output is correct |
29 | Correct | 169 ms | 512 KB | Output is correct |
30 | Correct | 170 ms | 512 KB | Output is correct |
31 | Correct | 167 ms | 636 KB | Output is correct |
32 | Correct | 172 ms | 544 KB | Output is correct |
33 | Correct | 166 ms | 512 KB | Output is correct |
34 | Correct | 168 ms | 632 KB | Output is correct |
35 | Correct | 167 ms | 512 KB | Output is correct |
36 | Correct | 168 ms | 512 KB | Output is correct |
37 | Correct | 536 ms | 544 KB | Output is correct |
38 | Correct | 537 ms | 632 KB | Output is correct |
39 | Correct | 787 ms | 632 KB | Output is correct |
40 | Correct | 913 ms | 632 KB | Output is correct |
41 | Correct | 914 ms | 632 KB | Output is correct |
42 | Correct | 805 ms | 544 KB | Output is correct |
43 | Correct | 766 ms | 760 KB | Output is correct |
44 | Correct | 784 ms | 760 KB | Output is correct |
45 | Correct | 798 ms | 760 KB | Output is correct |
46 | Correct | 913 ms | 540 KB | Output is correct |
47 | Correct | 797 ms | 632 KB | Output is correct |
48 | Correct | 804 ms | 632 KB | Output is correct |
49 | Correct | 798 ms | 544 KB | Output is correct |
50 | Correct | 793 ms | 632 KB | Output is correct |
51 | Correct | 3 ms | 384 KB | Output is correct |
52 | Correct | 918 ms | 668 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 512 KB | Output is correct |
5 | Correct | 11 ms | 512 KB | Output is correct |
6 | Correct | 7 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 512 KB | Output is correct |
8 | Correct | 11 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 512 KB | Output is correct |
10 | Correct | 31 ms | 512 KB | Output is correct |
11 | Correct | 30 ms | 512 KB | Output is correct |
12 | Correct | 30 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 512 KB | Output is correct |
14 | Correct | 28 ms | 512 KB | Output is correct |
15 | Correct | 28 ms | 512 KB | Output is correct |
16 | Correct | 30 ms | 512 KB | Output is correct |
17 | Correct | 17 ms | 512 KB | Output is correct |
18 | Correct | 23 ms | 512 KB | Output is correct |
19 | Correct | 25 ms | 512 KB | Output is correct |
20 | Correct | 30 ms | 512 KB | Output is correct |
21 | Correct | 85 ms | 512 KB | Output is correct |
22 | Correct | 105 ms | 512 KB | Output is correct |
23 | Correct | 61 ms | 512 KB | Output is correct |
24 | Correct | 153 ms | 636 KB | Output is correct |
25 | Correct | 154 ms | 512 KB | Output is correct |
26 | Correct | 167 ms | 632 KB | Output is correct |
27 | Correct | 169 ms | 512 KB | Output is correct |
28 | Correct | 169 ms | 632 KB | Output is correct |
29 | Correct | 169 ms | 512 KB | Output is correct |
30 | Correct | 170 ms | 512 KB | Output is correct |
31 | Correct | 167 ms | 636 KB | Output is correct |
32 | Correct | 172 ms | 544 KB | Output is correct |
33 | Correct | 166 ms | 512 KB | Output is correct |
34 | Correct | 168 ms | 632 KB | Output is correct |
35 | Correct | 167 ms | 512 KB | Output is correct |
36 | Correct | 168 ms | 512 KB | Output is correct |
37 | Correct | 536 ms | 544 KB | Output is correct |
38 | Correct | 537 ms | 632 KB | Output is correct |
39 | Correct | 787 ms | 632 KB | Output is correct |
40 | Correct | 913 ms | 632 KB | Output is correct |
41 | Correct | 914 ms | 632 KB | Output is correct |
42 | Correct | 805 ms | 544 KB | Output is correct |
43 | Correct | 766 ms | 760 KB | Output is correct |
44 | Correct | 784 ms | 760 KB | Output is correct |
45 | Correct | 798 ms | 760 KB | Output is correct |
46 | Correct | 913 ms | 540 KB | Output is correct |
47 | Correct | 797 ms | 632 KB | Output is correct |
48 | Correct | 804 ms | 632 KB | Output is correct |
49 | Correct | 798 ms | 544 KB | Output is correct |
50 | Correct | 793 ms | 632 KB | Output is correct |
51 | Correct | 3 ms | 384 KB | Output is correct |
52 | Correct | 918 ms | 668 KB | Output is correct |
53 | Execution timed out | 1087 ms | 512 KB | Time limit exceeded |
54 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 512 KB | Output is correct |
5 | Correct | 11 ms | 512 KB | Output is correct |
6 | Correct | 7 ms | 512 KB | Output is correct |
7 | Correct | 6 ms | 512 KB | Output is correct |
8 | Correct | 11 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 512 KB | Output is correct |
10 | Correct | 31 ms | 512 KB | Output is correct |
11 | Correct | 30 ms | 512 KB | Output is correct |
12 | Correct | 30 ms | 512 KB | Output is correct |
13 | Correct | 25 ms | 512 KB | Output is correct |
14 | Correct | 28 ms | 512 KB | Output is correct |
15 | Correct | 28 ms | 512 KB | Output is correct |
16 | Correct | 30 ms | 512 KB | Output is correct |
17 | Correct | 17 ms | 512 KB | Output is correct |
18 | Correct | 23 ms | 512 KB | Output is correct |
19 | Correct | 25 ms | 512 KB | Output is correct |
20 | Correct | 30 ms | 512 KB | Output is correct |
21 | Correct | 85 ms | 512 KB | Output is correct |
22 | Correct | 105 ms | 512 KB | Output is correct |
23 | Correct | 61 ms | 512 KB | Output is correct |
24 | Correct | 153 ms | 636 KB | Output is correct |
25 | Correct | 154 ms | 512 KB | Output is correct |
26 | Correct | 167 ms | 632 KB | Output is correct |
27 | Correct | 169 ms | 512 KB | Output is correct |
28 | Correct | 169 ms | 632 KB | Output is correct |
29 | Correct | 169 ms | 512 KB | Output is correct |
30 | Correct | 170 ms | 512 KB | Output is correct |
31 | Correct | 167 ms | 636 KB | Output is correct |
32 | Correct | 172 ms | 544 KB | Output is correct |
33 | Correct | 166 ms | 512 KB | Output is correct |
34 | Correct | 168 ms | 632 KB | Output is correct |
35 | Correct | 167 ms | 512 KB | Output is correct |
36 | Correct | 168 ms | 512 KB | Output is correct |
37 | Correct | 536 ms | 544 KB | Output is correct |
38 | Correct | 537 ms | 632 KB | Output is correct |
39 | Correct | 787 ms | 632 KB | Output is correct |
40 | Correct | 913 ms | 632 KB | Output is correct |
41 | Correct | 914 ms | 632 KB | Output is correct |
42 | Correct | 805 ms | 544 KB | Output is correct |
43 | Correct | 766 ms | 760 KB | Output is correct |
44 | Correct | 784 ms | 760 KB | Output is correct |
45 | Correct | 798 ms | 760 KB | Output is correct |
46 | Correct | 913 ms | 540 KB | Output is correct |
47 | Correct | 797 ms | 632 KB | Output is correct |
48 | Correct | 804 ms | 632 KB | Output is correct |
49 | Correct | 798 ms | 544 KB | Output is correct |
50 | Correct | 793 ms | 632 KB | Output is correct |
51 | Correct | 3 ms | 384 KB | Output is correct |
52 | Correct | 918 ms | 668 KB | Output is correct |
53 | Execution timed out | 1087 ms | 512 KB | Time limit exceeded |
54 | Halted | 0 ms | 0 KB | - |