# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169946 | 2019-12-23T10:57:55 Z | Dovran | Bootfall (IZhO17_bootfall) | C++11 | 435 ms | 3568 KB |
#include <bits/stdc++.h> #define N 1000009 #define pii pair <int, int> #define ff first #define ss second #define pb push_back #define ll long long using namespace std; int n, m, v[N], sum, vis[N], ism; int an[N]; vector<int>ans; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &v[i]), sum+=v[i]; vis[0] = 1; for(int i = 1; i <= n;i++) for(int j = sum; j >= 0; j--) vis[j+v[i]] += vis[j]; if(sum%2==1 or vis[sum/2]==0) return cout<<0, 0; for(int i = 1; i <= n; i++){ for(int j = v[i]; j <= sum;j++) vis[j] -= vis[j - v[i]]; for(int j = 1; j < sum; j++){ if(an[j]<i-1) continue; ism = sum - v[i] + j; if(ism % 2 == 0 and ism / 2 - j >= 0 and vis[ism / 2 - j]) an[j]++; } for(int j = sum; j >= v[i]; j--) vis[j] += vis[j - v[i]]; } for(int i = 1; i <= sum; i++) if(an[i] == n) ans.pb(i); printf("%d\n", ans.size()); for(auto i : ans) printf("%d ", i); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 400 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 400 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 452 KB | Output is correct |
26 | Correct | 6 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 504 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 504 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 400 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 452 KB | Output is correct |
26 | Correct | 6 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 504 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 504 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 760 KB | Output is correct |
38 | Correct | 17 ms | 632 KB | Output is correct |
39 | Correct | 47 ms | 888 KB | Output is correct |
40 | Correct | 35 ms | 888 KB | Output is correct |
41 | Correct | 60 ms | 888 KB | Output is correct |
42 | Correct | 30 ms | 780 KB | Output is correct |
43 | Correct | 52 ms | 1144 KB | Output is correct |
44 | Correct | 54 ms | 1144 KB | Output is correct |
45 | Correct | 55 ms | 1116 KB | Output is correct |
46 | Correct | 27 ms | 632 KB | Output is correct |
47 | Correct | 33 ms | 888 KB | Output is correct |
48 | Correct | 55 ms | 1144 KB | Output is correct |
49 | Correct | 50 ms | 888 KB | Output is correct |
50 | Correct | 32 ms | 760 KB | Output is correct |
51 | Correct | 7 ms | 504 KB | Output is correct |
52 | Correct | 70 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 400 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 452 KB | Output is correct |
26 | Correct | 6 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 504 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 504 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 760 KB | Output is correct |
38 | Correct | 17 ms | 632 KB | Output is correct |
39 | Correct | 47 ms | 888 KB | Output is correct |
40 | Correct | 35 ms | 888 KB | Output is correct |
41 | Correct | 60 ms | 888 KB | Output is correct |
42 | Correct | 30 ms | 780 KB | Output is correct |
43 | Correct | 52 ms | 1144 KB | Output is correct |
44 | Correct | 54 ms | 1144 KB | Output is correct |
45 | Correct | 55 ms | 1116 KB | Output is correct |
46 | Correct | 27 ms | 632 KB | Output is correct |
47 | Correct | 33 ms | 888 KB | Output is correct |
48 | Correct | 55 ms | 1144 KB | Output is correct |
49 | Correct | 50 ms | 888 KB | Output is correct |
50 | Correct | 32 ms | 760 KB | Output is correct |
51 | Correct | 7 ms | 504 KB | Output is correct |
52 | Correct | 70 ms | 1272 KB | Output is correct |
53 | Correct | 54 ms | 996 KB | Output is correct |
54 | Correct | 80 ms | 1196 KB | Output is correct |
55 | Correct | 144 ms | 2008 KB | Output is correct |
56 | Correct | 66 ms | 1144 KB | Output is correct |
57 | Correct | 152 ms | 1940 KB | Output is correct |
58 | Correct | 82 ms | 1400 KB | Output is correct |
59 | Correct | 101 ms | 1652 KB | Output is correct |
60 | Correct | 16 ms | 632 KB | Output is correct |
61 | Correct | 113 ms | 1624 KB | Output is correct |
62 | Correct | 115 ms | 1780 KB | Output is correct |
63 | Correct | 124 ms | 1836 KB | Output is correct |
64 | Correct | 120 ms | 1904 KB | Output is correct |
65 | Correct | 50 ms | 760 KB | Output is correct |
66 | Correct | 53 ms | 760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 400 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 4 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 452 KB | Output is correct |
26 | Correct | 6 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 504 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 4 ms | 376 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 4 ms | 376 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 376 KB | Output is correct |
35 | Correct | 5 ms | 504 KB | Output is correct |
36 | Correct | 4 ms | 376 KB | Output is correct |
37 | Correct | 17 ms | 760 KB | Output is correct |
38 | Correct | 17 ms | 632 KB | Output is correct |
39 | Correct | 47 ms | 888 KB | Output is correct |
40 | Correct | 35 ms | 888 KB | Output is correct |
41 | Correct | 60 ms | 888 KB | Output is correct |
42 | Correct | 30 ms | 780 KB | Output is correct |
43 | Correct | 52 ms | 1144 KB | Output is correct |
44 | Correct | 54 ms | 1144 KB | Output is correct |
45 | Correct | 55 ms | 1116 KB | Output is correct |
46 | Correct | 27 ms | 632 KB | Output is correct |
47 | Correct | 33 ms | 888 KB | Output is correct |
48 | Correct | 55 ms | 1144 KB | Output is correct |
49 | Correct | 50 ms | 888 KB | Output is correct |
50 | Correct | 32 ms | 760 KB | Output is correct |
51 | Correct | 7 ms | 504 KB | Output is correct |
52 | Correct | 70 ms | 1272 KB | Output is correct |
53 | Correct | 54 ms | 996 KB | Output is correct |
54 | Correct | 80 ms | 1196 KB | Output is correct |
55 | Correct | 144 ms | 2008 KB | Output is correct |
56 | Correct | 66 ms | 1144 KB | Output is correct |
57 | Correct | 152 ms | 1940 KB | Output is correct |
58 | Correct | 82 ms | 1400 KB | Output is correct |
59 | Correct | 101 ms | 1652 KB | Output is correct |
60 | Correct | 16 ms | 632 KB | Output is correct |
61 | Correct | 113 ms | 1624 KB | Output is correct |
62 | Correct | 115 ms | 1780 KB | Output is correct |
63 | Correct | 124 ms | 1836 KB | Output is correct |
64 | Correct | 120 ms | 1904 KB | Output is correct |
65 | Correct | 50 ms | 760 KB | Output is correct |
66 | Correct | 53 ms | 760 KB | Output is correct |
67 | Correct | 121 ms | 1496 KB | Output is correct |
68 | Correct | 41 ms | 760 KB | Output is correct |
69 | Correct | 386 ms | 3312 KB | Output is correct |
70 | Correct | 238 ms | 2284 KB | Output is correct |
71 | Correct | 229 ms | 2164 KB | Output is correct |
72 | Correct | 185 ms | 1404 KB | Output is correct |
73 | Correct | 183 ms | 1400 KB | Output is correct |
74 | Correct | 408 ms | 3312 KB | Output is correct |
75 | Correct | 321 ms | 2928 KB | Output is correct |
76 | Correct | 435 ms | 3568 KB | Output is correct |
77 | Correct | 430 ms | 3520 KB | Output is correct |