# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
36181 | 2017-12-06T07:20:30 Z | ToMoClone | Bootfall (IZhO17_bootfall) | C++14 | 679 ms | 6976 KB |
/*input 4 1 3 1 5 */ #include <stdio.h> #include <vector> using namespace std; const int N = 501; int check[N * N], cnt[250001], num[1000001], a[N], n, sum, ans; int main(){ scanf("%d", &n); check[0] = 1; for(int i = 1; i <= n; ++i){ scanf("%d", &a[i]), sum += a[i]; for(int j = sum; j >= a[i]; --j) check[j] += check[j - a[i]]; } if((sum & 1) || check[sum >> 1] == 0) return puts("0"), 0; for(int i = 1; i <= n; ++i){ for(int j = 0; j <= sum - a[i]; ++j) check[j + a[i]] -= check[j]; for(int j = 1; j <= sum; ++j){ int Sum = sum + j - a[i]; if((Sum & 1) || ((Sum >> 1) < j)) continue; if(check[Sum >> 1] != 0 && check[(Sum >> 1) - j] != 0) ++num[j]; ans += (num[j] == n); } for(int j = sum; j >= a[i]; --j) check[j] += check[j - a[i]]; } printf("%d\n", ans); if(ans != 0){ for(int i = 1; i <= sum; ++i) if(num[i] == n) printf("%d ", i); puts(""); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6976 KB | Output is correct |
2 | Correct | 0 ms | 6976 KB | Output is correct |
3 | Correct | 0 ms | 6976 KB | Output is correct |
4 | Correct | 0 ms | 6976 KB | Output is correct |
5 | Correct | 0 ms | 6976 KB | Output is correct |
6 | Correct | 0 ms | 6976 KB | Output is correct |
7 | Correct | 0 ms | 6976 KB | Output is correct |
8 | Correct | 0 ms | 6976 KB | Output is correct |
9 | Correct | 0 ms | 6976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6976 KB | Output is correct |
2 | Correct | 0 ms | 6976 KB | Output is correct |
3 | Correct | 0 ms | 6976 KB | Output is correct |
4 | Correct | 0 ms | 6976 KB | Output is correct |
5 | Correct | 0 ms | 6976 KB | Output is correct |
6 | Correct | 0 ms | 6976 KB | Output is correct |
7 | Correct | 0 ms | 6976 KB | Output is correct |
8 | Correct | 0 ms | 6976 KB | Output is correct |
9 | Correct | 0 ms | 6976 KB | Output is correct |
10 | Correct | 0 ms | 6976 KB | Output is correct |
11 | Correct | 0 ms | 6976 KB | Output is correct |
12 | Correct | 0 ms | 6976 KB | Output is correct |
13 | Correct | 0 ms | 6976 KB | Output is correct |
14 | Correct | 0 ms | 6976 KB | Output is correct |
15 | Correct | 0 ms | 6976 KB | Output is correct |
16 | Correct | 0 ms | 6976 KB | Output is correct |
17 | Correct | 0 ms | 6976 KB | Output is correct |
18 | Correct | 0 ms | 6976 KB | Output is correct |
19 | Correct | 0 ms | 6976 KB | Output is correct |
20 | Correct | 0 ms | 6976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6976 KB | Output is correct |
2 | Correct | 0 ms | 6976 KB | Output is correct |
3 | Correct | 0 ms | 6976 KB | Output is correct |
4 | Correct | 0 ms | 6976 KB | Output is correct |
5 | Correct | 0 ms | 6976 KB | Output is correct |
6 | Correct | 0 ms | 6976 KB | Output is correct |
7 | Correct | 0 ms | 6976 KB | Output is correct |
8 | Correct | 0 ms | 6976 KB | Output is correct |
9 | Correct | 0 ms | 6976 KB | Output is correct |
10 | Correct | 0 ms | 6976 KB | Output is correct |
11 | Correct | 0 ms | 6976 KB | Output is correct |
12 | Correct | 0 ms | 6976 KB | Output is correct |
13 | Correct | 0 ms | 6976 KB | Output is correct |
14 | Correct | 0 ms | 6976 KB | Output is correct |
15 | Correct | 0 ms | 6976 KB | Output is correct |
16 | Correct | 0 ms | 6976 KB | Output is correct |
17 | Correct | 0 ms | 6976 KB | Output is correct |
18 | Correct | 0 ms | 6976 KB | Output is correct |
19 | Correct | 0 ms | 6976 KB | Output is correct |
20 | Correct | 0 ms | 6976 KB | Output is correct |
21 | Correct | 0 ms | 6976 KB | Output is correct |
22 | Correct | 0 ms | 6976 KB | Output is correct |
23 | Correct | 0 ms | 6976 KB | Output is correct |
24 | Correct | 0 ms | 6976 KB | Output is correct |
25 | Correct | 3 ms | 6976 KB | Output is correct |
26 | Correct | 3 ms | 6976 KB | Output is correct |
27 | Correct | 3 ms | 6976 KB | Output is correct |
28 | Correct | 3 ms | 6976 KB | Output is correct |
29 | Correct | 3 ms | 6976 KB | Output is correct |
30 | Correct | 0 ms | 6976 KB | Output is correct |
31 | Correct | 3 ms | 6976 KB | Output is correct |
32 | Correct | 3 ms | 6976 KB | Output is correct |
33 | Correct | 3 ms | 6976 KB | Output is correct |
34 | Correct | 3 ms | 6976 KB | Output is correct |
35 | Correct | 3 ms | 6976 KB | Output is correct |
36 | Correct | 0 ms | 6976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6976 KB | Output is correct |
2 | Correct | 0 ms | 6976 KB | Output is correct |
3 | Correct | 0 ms | 6976 KB | Output is correct |
4 | Correct | 0 ms | 6976 KB | Output is correct |
5 | Correct | 0 ms | 6976 KB | Output is correct |
6 | Correct | 0 ms | 6976 KB | Output is correct |
7 | Correct | 0 ms | 6976 KB | Output is correct |
8 | Correct | 0 ms | 6976 KB | Output is correct |
9 | Correct | 0 ms | 6976 KB | Output is correct |
10 | Correct | 0 ms | 6976 KB | Output is correct |
11 | Correct | 0 ms | 6976 KB | Output is correct |
12 | Correct | 0 ms | 6976 KB | Output is correct |
13 | Correct | 0 ms | 6976 KB | Output is correct |
14 | Correct | 0 ms | 6976 KB | Output is correct |
15 | Correct | 0 ms | 6976 KB | Output is correct |
16 | Correct | 0 ms | 6976 KB | Output is correct |
17 | Correct | 0 ms | 6976 KB | Output is correct |
18 | Correct | 0 ms | 6976 KB | Output is correct |
19 | Correct | 0 ms | 6976 KB | Output is correct |
20 | Correct | 0 ms | 6976 KB | Output is correct |
21 | Correct | 0 ms | 6976 KB | Output is correct |
22 | Correct | 0 ms | 6976 KB | Output is correct |
23 | Correct | 0 ms | 6976 KB | Output is correct |
24 | Correct | 0 ms | 6976 KB | Output is correct |
25 | Correct | 3 ms | 6976 KB | Output is correct |
26 | Correct | 3 ms | 6976 KB | Output is correct |
27 | Correct | 3 ms | 6976 KB | Output is correct |
28 | Correct | 3 ms | 6976 KB | Output is correct |
29 | Correct | 3 ms | 6976 KB | Output is correct |
30 | Correct | 0 ms | 6976 KB | Output is correct |
31 | Correct | 3 ms | 6976 KB | Output is correct |
32 | Correct | 3 ms | 6976 KB | Output is correct |
33 | Correct | 3 ms | 6976 KB | Output is correct |
34 | Correct | 3 ms | 6976 KB | Output is correct |
35 | Correct | 3 ms | 6976 KB | Output is correct |
36 | Correct | 0 ms | 6976 KB | Output is correct |
37 | Correct | 16 ms | 6976 KB | Output is correct |
38 | Correct | 23 ms | 6976 KB | Output is correct |
39 | Correct | 83 ms | 6976 KB | Output is correct |
40 | Correct | 43 ms | 6976 KB | Output is correct |
41 | Correct | 86 ms | 6976 KB | Output is correct |
42 | Correct | 39 ms | 6976 KB | Output is correct |
43 | Correct | 63 ms | 6976 KB | Output is correct |
44 | Correct | 66 ms | 6976 KB | Output is correct |
45 | Correct | 66 ms | 6976 KB | Output is correct |
46 | Correct | 39 ms | 6976 KB | Output is correct |
47 | Correct | 39 ms | 6976 KB | Output is correct |
48 | Correct | 123 ms | 6976 KB | Output is correct |
49 | Correct | 69 ms | 6976 KB | Output is correct |
50 | Correct | 39 ms | 6976 KB | Output is correct |
51 | Correct | 3 ms | 6976 KB | Output is correct |
52 | Correct | 93 ms | 6976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6976 KB | Output is correct |
2 | Correct | 0 ms | 6976 KB | Output is correct |
3 | Correct | 0 ms | 6976 KB | Output is correct |
4 | Correct | 0 ms | 6976 KB | Output is correct |
5 | Correct | 0 ms | 6976 KB | Output is correct |
6 | Correct | 0 ms | 6976 KB | Output is correct |
7 | Correct | 0 ms | 6976 KB | Output is correct |
8 | Correct | 0 ms | 6976 KB | Output is correct |
9 | Correct | 0 ms | 6976 KB | Output is correct |
10 | Correct | 0 ms | 6976 KB | Output is correct |
11 | Correct | 0 ms | 6976 KB | Output is correct |
12 | Correct | 0 ms | 6976 KB | Output is correct |
13 | Correct | 0 ms | 6976 KB | Output is correct |
14 | Correct | 0 ms | 6976 KB | Output is correct |
15 | Correct | 0 ms | 6976 KB | Output is correct |
16 | Correct | 0 ms | 6976 KB | Output is correct |
17 | Correct | 0 ms | 6976 KB | Output is correct |
18 | Correct | 0 ms | 6976 KB | Output is correct |
19 | Correct | 0 ms | 6976 KB | Output is correct |
20 | Correct | 0 ms | 6976 KB | Output is correct |
21 | Correct | 0 ms | 6976 KB | Output is correct |
22 | Correct | 0 ms | 6976 KB | Output is correct |
23 | Correct | 0 ms | 6976 KB | Output is correct |
24 | Correct | 0 ms | 6976 KB | Output is correct |
25 | Correct | 3 ms | 6976 KB | Output is correct |
26 | Correct | 3 ms | 6976 KB | Output is correct |
27 | Correct | 3 ms | 6976 KB | Output is correct |
28 | Correct | 3 ms | 6976 KB | Output is correct |
29 | Correct | 3 ms | 6976 KB | Output is correct |
30 | Correct | 0 ms | 6976 KB | Output is correct |
31 | Correct | 3 ms | 6976 KB | Output is correct |
32 | Correct | 3 ms | 6976 KB | Output is correct |
33 | Correct | 3 ms | 6976 KB | Output is correct |
34 | Correct | 3 ms | 6976 KB | Output is correct |
35 | Correct | 3 ms | 6976 KB | Output is correct |
36 | Correct | 0 ms | 6976 KB | Output is correct |
37 | Correct | 16 ms | 6976 KB | Output is correct |
38 | Correct | 23 ms | 6976 KB | Output is correct |
39 | Correct | 83 ms | 6976 KB | Output is correct |
40 | Correct | 43 ms | 6976 KB | Output is correct |
41 | Correct | 86 ms | 6976 KB | Output is correct |
42 | Correct | 39 ms | 6976 KB | Output is correct |
43 | Correct | 63 ms | 6976 KB | Output is correct |
44 | Correct | 66 ms | 6976 KB | Output is correct |
45 | Correct | 66 ms | 6976 KB | Output is correct |
46 | Correct | 39 ms | 6976 KB | Output is correct |
47 | Correct | 39 ms | 6976 KB | Output is correct |
48 | Correct | 123 ms | 6976 KB | Output is correct |
49 | Correct | 69 ms | 6976 KB | Output is correct |
50 | Correct | 39 ms | 6976 KB | Output is correct |
51 | Correct | 3 ms | 6976 KB | Output is correct |
52 | Correct | 93 ms | 6976 KB | Output is correct |
53 | Correct | 63 ms | 6976 KB | Output is correct |
54 | Correct | 89 ms | 6976 KB | Output is correct |
55 | Correct | 203 ms | 6976 KB | Output is correct |
56 | Correct | 79 ms | 6976 KB | Output is correct |
57 | Correct | 186 ms | 6976 KB | Output is correct |
58 | Correct | 106 ms | 6976 KB | Output is correct |
59 | Correct | 123 ms | 6976 KB | Output is correct |
60 | Correct | 13 ms | 6976 KB | Output is correct |
61 | Correct | 136 ms | 6976 KB | Output is correct |
62 | Correct | 143 ms | 6976 KB | Output is correct |
63 | Correct | 153 ms | 6976 KB | Output is correct |
64 | Correct | 146 ms | 6976 KB | Output is correct |
65 | Correct | 73 ms | 6976 KB | Output is correct |
66 | Correct | 76 ms | 6976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 6976 KB | Output is correct |
2 | Correct | 0 ms | 6976 KB | Output is correct |
3 | Correct | 0 ms | 6976 KB | Output is correct |
4 | Correct | 0 ms | 6976 KB | Output is correct |
5 | Correct | 0 ms | 6976 KB | Output is correct |
6 | Correct | 0 ms | 6976 KB | Output is correct |
7 | Correct | 0 ms | 6976 KB | Output is correct |
8 | Correct | 0 ms | 6976 KB | Output is correct |
9 | Correct | 0 ms | 6976 KB | Output is correct |
10 | Correct | 0 ms | 6976 KB | Output is correct |
11 | Correct | 0 ms | 6976 KB | Output is correct |
12 | Correct | 0 ms | 6976 KB | Output is correct |
13 | Correct | 0 ms | 6976 KB | Output is correct |
14 | Correct | 0 ms | 6976 KB | Output is correct |
15 | Correct | 0 ms | 6976 KB | Output is correct |
16 | Correct | 0 ms | 6976 KB | Output is correct |
17 | Correct | 0 ms | 6976 KB | Output is correct |
18 | Correct | 0 ms | 6976 KB | Output is correct |
19 | Correct | 0 ms | 6976 KB | Output is correct |
20 | Correct | 0 ms | 6976 KB | Output is correct |
21 | Correct | 0 ms | 6976 KB | Output is correct |
22 | Correct | 0 ms | 6976 KB | Output is correct |
23 | Correct | 0 ms | 6976 KB | Output is correct |
24 | Correct | 0 ms | 6976 KB | Output is correct |
25 | Correct | 3 ms | 6976 KB | Output is correct |
26 | Correct | 3 ms | 6976 KB | Output is correct |
27 | Correct | 3 ms | 6976 KB | Output is correct |
28 | Correct | 3 ms | 6976 KB | Output is correct |
29 | Correct | 3 ms | 6976 KB | Output is correct |
30 | Correct | 0 ms | 6976 KB | Output is correct |
31 | Correct | 3 ms | 6976 KB | Output is correct |
32 | Correct | 3 ms | 6976 KB | Output is correct |
33 | Correct | 3 ms | 6976 KB | Output is correct |
34 | Correct | 3 ms | 6976 KB | Output is correct |
35 | Correct | 3 ms | 6976 KB | Output is correct |
36 | Correct | 0 ms | 6976 KB | Output is correct |
37 | Correct | 16 ms | 6976 KB | Output is correct |
38 | Correct | 23 ms | 6976 KB | Output is correct |
39 | Correct | 83 ms | 6976 KB | Output is correct |
40 | Correct | 43 ms | 6976 KB | Output is correct |
41 | Correct | 86 ms | 6976 KB | Output is correct |
42 | Correct | 39 ms | 6976 KB | Output is correct |
43 | Correct | 63 ms | 6976 KB | Output is correct |
44 | Correct | 66 ms | 6976 KB | Output is correct |
45 | Correct | 66 ms | 6976 KB | Output is correct |
46 | Correct | 39 ms | 6976 KB | Output is correct |
47 | Correct | 39 ms | 6976 KB | Output is correct |
48 | Correct | 123 ms | 6976 KB | Output is correct |
49 | Correct | 69 ms | 6976 KB | Output is correct |
50 | Correct | 39 ms | 6976 KB | Output is correct |
51 | Correct | 3 ms | 6976 KB | Output is correct |
52 | Correct | 93 ms | 6976 KB | Output is correct |
53 | Correct | 63 ms | 6976 KB | Output is correct |
54 | Correct | 89 ms | 6976 KB | Output is correct |
55 | Correct | 203 ms | 6976 KB | Output is correct |
56 | Correct | 79 ms | 6976 KB | Output is correct |
57 | Correct | 186 ms | 6976 KB | Output is correct |
58 | Correct | 106 ms | 6976 KB | Output is correct |
59 | Correct | 123 ms | 6976 KB | Output is correct |
60 | Correct | 13 ms | 6976 KB | Output is correct |
61 | Correct | 136 ms | 6976 KB | Output is correct |
62 | Correct | 143 ms | 6976 KB | Output is correct |
63 | Correct | 153 ms | 6976 KB | Output is correct |
64 | Correct | 146 ms | 6976 KB | Output is correct |
65 | Correct | 73 ms | 6976 KB | Output is correct |
66 | Correct | 76 ms | 6976 KB | Output is correct |
67 | Correct | 149 ms | 6976 KB | Output is correct |
68 | Correct | 36 ms | 6976 KB | Output is correct |
69 | Correct | 473 ms | 6976 KB | Output is correct |
70 | Correct | 319 ms | 6976 KB | Output is correct |
71 | Correct | 313 ms | 6976 KB | Output is correct |
72 | Correct | 319 ms | 6976 KB | Output is correct |
73 | Correct | 289 ms | 6976 KB | Output is correct |
74 | Correct | 679 ms | 6976 KB | Output is correct |
75 | Correct | 436 ms | 6976 KB | Output is correct |
76 | Correct | 579 ms | 6976 KB | Output is correct |
77 | Correct | 616 ms | 6976 KB | Output is correct |