# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
211290 | 2020-03-20T01:45:37 Z | nouvo25 | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 1524 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 507; int n, a[maxn], cnt[maxn*maxn], s = 0; bitset<maxn*maxn / 2> f; vector<int> ans; int main() { // freopen("test.INP","r",stdin); scanf("%d",&n); for (int i = 1; i <= n; ++i) scanf("%d",&a[i]), s += a[i]; if (s % 2) return puts("0"), 0; f[0] = 1; for (int i = 1; i <= n; ++i) f |= (f << a[i]); if (!f[s / 2]) return puts("0"), 0; for (int i = 1; i <= n; ++i) { int t = s - a[i]; for (int j = 1; j + j <= t; ++j) f[j] = 0; for (int j = 1; j <= n; ++j) if (j != i) f |= (f << a[j]); for (int j = 0; j + j <= t; ++j) cnt[t - j - j] += f[j]; } for (int i = 0; i <= s; ++i) if (cnt[i] == n) ans.push_back(i); printf("%d\n",ans.size()); for (auto v: ans) printf("%d ",v); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 9 ms | 384 KB | Output is correct |
11 | Correct | 9 ms | 384 KB | Output is correct |
12 | Correct | 8 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 8 ms | 384 KB | Output is correct |
15 | Correct | 8 ms | 384 KB | Output is correct |
16 | Correct | 12 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 9 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 9 ms | 384 KB | Output is correct |
11 | Correct | 9 ms | 384 KB | Output is correct |
12 | Correct | 8 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 8 ms | 384 KB | Output is correct |
15 | Correct | 8 ms | 384 KB | Output is correct |
16 | Correct | 12 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 9 ms | 384 KB | Output is correct |
21 | Correct | 39 ms | 384 KB | Output is correct |
22 | Correct | 29 ms | 384 KB | Output is correct |
23 | Correct | 20 ms | 384 KB | Output is correct |
24 | Correct | 44 ms | 440 KB | Output is correct |
25 | Correct | 69 ms | 384 KB | Output is correct |
26 | Correct | 58 ms | 508 KB | Output is correct |
27 | Correct | 52 ms | 504 KB | Output is correct |
28 | Correct | 49 ms | 384 KB | Output is correct |
29 | Correct | 52 ms | 384 KB | Output is correct |
30 | Correct | 54 ms | 384 KB | Output is correct |
31 | Correct | 52 ms | 444 KB | Output is correct |
32 | Correct | 50 ms | 384 KB | Output is correct |
33 | Correct | 56 ms | 384 KB | Output is correct |
34 | Correct | 53 ms | 384 KB | Output is correct |
35 | Correct | 49 ms | 384 KB | Output is correct |
36 | Correct | 52 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 9 ms | 384 KB | Output is correct |
11 | Correct | 9 ms | 384 KB | Output is correct |
12 | Correct | 8 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 8 ms | 384 KB | Output is correct |
15 | Correct | 8 ms | 384 KB | Output is correct |
16 | Correct | 12 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 9 ms | 384 KB | Output is correct |
21 | Correct | 39 ms | 384 KB | Output is correct |
22 | Correct | 29 ms | 384 KB | Output is correct |
23 | Correct | 20 ms | 384 KB | Output is correct |
24 | Correct | 44 ms | 440 KB | Output is correct |
25 | Correct | 69 ms | 384 KB | Output is correct |
26 | Correct | 58 ms | 508 KB | Output is correct |
27 | Correct | 52 ms | 504 KB | Output is correct |
28 | Correct | 49 ms | 384 KB | Output is correct |
29 | Correct | 52 ms | 384 KB | Output is correct |
30 | Correct | 54 ms | 384 KB | Output is correct |
31 | Correct | 52 ms | 444 KB | Output is correct |
32 | Correct | 50 ms | 384 KB | Output is correct |
33 | Correct | 56 ms | 384 KB | Output is correct |
34 | Correct | 53 ms | 384 KB | Output is correct |
35 | Correct | 49 ms | 384 KB | Output is correct |
36 | Correct | 52 ms | 384 KB | Output is correct |
37 | Correct | 191 ms | 632 KB | Output is correct |
38 | Correct | 186 ms | 632 KB | Output is correct |
39 | Correct | 310 ms | 640 KB | Output is correct |
40 | Correct | 367 ms | 760 KB | Output is correct |
41 | Correct | 382 ms | 640 KB | Output is correct |
42 | Correct | 326 ms | 632 KB | Output is correct |
43 | Correct | 285 ms | 1016 KB | Output is correct |
44 | Correct | 317 ms | 1144 KB | Output is correct |
45 | Correct | 300 ms | 1016 KB | Output is correct |
46 | Correct | 351 ms | 632 KB | Output is correct |
47 | Correct | 318 ms | 760 KB | Output is correct |
48 | Correct | 318 ms | 908 KB | Output is correct |
49 | Correct | 324 ms | 640 KB | Output is correct |
50 | Correct | 319 ms | 632 KB | Output is correct |
51 | Correct | 4 ms | 384 KB | Output is correct |
52 | Correct | 386 ms | 1016 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 9 ms | 384 KB | Output is correct |
11 | Correct | 9 ms | 384 KB | Output is correct |
12 | Correct | 8 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 8 ms | 384 KB | Output is correct |
15 | Correct | 8 ms | 384 KB | Output is correct |
16 | Correct | 12 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 9 ms | 384 KB | Output is correct |
21 | Correct | 39 ms | 384 KB | Output is correct |
22 | Correct | 29 ms | 384 KB | Output is correct |
23 | Correct | 20 ms | 384 KB | Output is correct |
24 | Correct | 44 ms | 440 KB | Output is correct |
25 | Correct | 69 ms | 384 KB | Output is correct |
26 | Correct | 58 ms | 508 KB | Output is correct |
27 | Correct | 52 ms | 504 KB | Output is correct |
28 | Correct | 49 ms | 384 KB | Output is correct |
29 | Correct | 52 ms | 384 KB | Output is correct |
30 | Correct | 54 ms | 384 KB | Output is correct |
31 | Correct | 52 ms | 444 KB | Output is correct |
32 | Correct | 50 ms | 384 KB | Output is correct |
33 | Correct | 56 ms | 384 KB | Output is correct |
34 | Correct | 53 ms | 384 KB | Output is correct |
35 | Correct | 49 ms | 384 KB | Output is correct |
36 | Correct | 52 ms | 384 KB | Output is correct |
37 | Correct | 191 ms | 632 KB | Output is correct |
38 | Correct | 186 ms | 632 KB | Output is correct |
39 | Correct | 310 ms | 640 KB | Output is correct |
40 | Correct | 367 ms | 760 KB | Output is correct |
41 | Correct | 382 ms | 640 KB | Output is correct |
42 | Correct | 326 ms | 632 KB | Output is correct |
43 | Correct | 285 ms | 1016 KB | Output is correct |
44 | Correct | 317 ms | 1144 KB | Output is correct |
45 | Correct | 300 ms | 1016 KB | Output is correct |
46 | Correct | 351 ms | 632 KB | Output is correct |
47 | Correct | 318 ms | 760 KB | Output is correct |
48 | Correct | 318 ms | 908 KB | Output is correct |
49 | Correct | 324 ms | 640 KB | Output is correct |
50 | Correct | 319 ms | 632 KB | Output is correct |
51 | Correct | 4 ms | 384 KB | Output is correct |
52 | Correct | 386 ms | 1016 KB | Output is correct |
53 | Correct | 452 ms | 888 KB | Output is correct |
54 | Correct | 619 ms | 1020 KB | Output is correct |
55 | Correct | 647 ms | 1524 KB | Output is correct |
56 | Correct | 475 ms | 1144 KB | Output is correct |
57 | Correct | 664 ms | 1508 KB | Output is correct |
58 | Correct | 628 ms | 1016 KB | Output is correct |
59 | Correct | 572 ms | 1140 KB | Output is correct |
60 | Correct | 4 ms | 384 KB | Output is correct |
61 | Correct | 605 ms | 1268 KB | Output is correct |
62 | Correct | 556 ms | 1396 KB | Output is correct |
63 | Correct | 501 ms | 1444 KB | Output is correct |
64 | Correct | 535 ms | 1396 KB | Output is correct |
65 | Correct | 504 ms | 512 KB | Output is correct |
66 | Correct | 453 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 9 ms | 384 KB | Output is correct |
11 | Correct | 9 ms | 384 KB | Output is correct |
12 | Correct | 8 ms | 384 KB | Output is correct |
13 | Correct | 8 ms | 384 KB | Output is correct |
14 | Correct | 8 ms | 384 KB | Output is correct |
15 | Correct | 8 ms | 384 KB | Output is correct |
16 | Correct | 12 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 7 ms | 384 KB | Output is correct |
19 | Correct | 8 ms | 384 KB | Output is correct |
20 | Correct | 9 ms | 384 KB | Output is correct |
21 | Correct | 39 ms | 384 KB | Output is correct |
22 | Correct | 29 ms | 384 KB | Output is correct |
23 | Correct | 20 ms | 384 KB | Output is correct |
24 | Correct | 44 ms | 440 KB | Output is correct |
25 | Correct | 69 ms | 384 KB | Output is correct |
26 | Correct | 58 ms | 508 KB | Output is correct |
27 | Correct | 52 ms | 504 KB | Output is correct |
28 | Correct | 49 ms | 384 KB | Output is correct |
29 | Correct | 52 ms | 384 KB | Output is correct |
30 | Correct | 54 ms | 384 KB | Output is correct |
31 | Correct | 52 ms | 444 KB | Output is correct |
32 | Correct | 50 ms | 384 KB | Output is correct |
33 | Correct | 56 ms | 384 KB | Output is correct |
34 | Correct | 53 ms | 384 KB | Output is correct |
35 | Correct | 49 ms | 384 KB | Output is correct |
36 | Correct | 52 ms | 384 KB | Output is correct |
37 | Correct | 191 ms | 632 KB | Output is correct |
38 | Correct | 186 ms | 632 KB | Output is correct |
39 | Correct | 310 ms | 640 KB | Output is correct |
40 | Correct | 367 ms | 760 KB | Output is correct |
41 | Correct | 382 ms | 640 KB | Output is correct |
42 | Correct | 326 ms | 632 KB | Output is correct |
43 | Correct | 285 ms | 1016 KB | Output is correct |
44 | Correct | 317 ms | 1144 KB | Output is correct |
45 | Correct | 300 ms | 1016 KB | Output is correct |
46 | Correct | 351 ms | 632 KB | Output is correct |
47 | Correct | 318 ms | 760 KB | Output is correct |
48 | Correct | 318 ms | 908 KB | Output is correct |
49 | Correct | 324 ms | 640 KB | Output is correct |
50 | Correct | 319 ms | 632 KB | Output is correct |
51 | Correct | 4 ms | 384 KB | Output is correct |
52 | Correct | 386 ms | 1016 KB | Output is correct |
53 | Correct | 452 ms | 888 KB | Output is correct |
54 | Correct | 619 ms | 1020 KB | Output is correct |
55 | Correct | 647 ms | 1524 KB | Output is correct |
56 | Correct | 475 ms | 1144 KB | Output is correct |
57 | Correct | 664 ms | 1508 KB | Output is correct |
58 | Correct | 628 ms | 1016 KB | Output is correct |
59 | Correct | 572 ms | 1140 KB | Output is correct |
60 | Correct | 4 ms | 384 KB | Output is correct |
61 | Correct | 605 ms | 1268 KB | Output is correct |
62 | Correct | 556 ms | 1396 KB | Output is correct |
63 | Correct | 501 ms | 1444 KB | Output is correct |
64 | Correct | 535 ms | 1396 KB | Output is correct |
65 | Correct | 504 ms | 512 KB | Output is correct |
66 | Correct | 453 ms | 632 KB | Output is correct |
67 | Correct | 797 ms | 1268 KB | Output is correct |
68 | Correct | 7 ms | 384 KB | Output is correct |
69 | Execution timed out | 1093 ms | 1152 KB | Time limit exceeded |
70 | Halted | 0 ms | 0 KB | - |