# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
682013 | 2023-01-15T08:36:42 Z | boykut | Bootfall (IZhO17_bootfall) | C++14 | 363 ms | 3464 KB |
#include <bits/stdc++.h> using namespace std; const int MAX = 1000; int dp[MAX*MAX], can[MAX*MAX]; int a[MAX]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, sum = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; } dp[0] = 1; for (int i = 0; i < n; i++) { for (int x = sum; x >= 0; x--) { dp[x+a[i]] += dp[x]; } } if (sum%2 == 1 || dp[sum/2] == 0) { return cout << 0, 0; } fill(can, can+sum+1, 1); vector<int> ans; for (int Without = 0; Without < n; Without++) { // a[Without] êàìåðà êàðìàï òóðàò for (int x = 0; x <= sum; x++) { dp[x+a[Without]] -= dp[x]; } for (int Tima = 1; Tima <= sum; Tima++) { if ((sum-a[Without]+Tima)%2 == 1 || dp[(sum-a[Without]+Tima)/2] == 0) { can[Tima] = 0; } } for (int x = sum; x >= 0; x--) { dp[x+a[Without]] += dp[x]; } } for (int Tima = 1; Tima <= sum; Tima++) { if (can[Tima] == 1) { ans.push_back(Tima); } } cout << ans.size() << "\n"; for (int i = 0; i < ans.size(); i++) { cout << ans[i] << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 340 KB | Output is correct |
26 | Correct | 4 ms | 568 KB | Output is correct |
27 | Correct | 3 ms | 340 KB | Output is correct |
28 | Correct | 3 ms | 340 KB | Output is correct |
29 | Correct | 3 ms | 340 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 340 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 4 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 340 KB | Output is correct |
35 | Correct | 3 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 340 KB | Output is correct |
26 | Correct | 4 ms | 568 KB | Output is correct |
27 | Correct | 3 ms | 340 KB | Output is correct |
28 | Correct | 3 ms | 340 KB | Output is correct |
29 | Correct | 3 ms | 340 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 340 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 4 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 340 KB | Output is correct |
35 | Correct | 3 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
37 | Correct | 12 ms | 596 KB | Output is correct |
38 | Correct | 14 ms | 596 KB | Output is correct |
39 | Correct | 41 ms | 724 KB | Output is correct |
40 | Correct | 26 ms | 708 KB | Output is correct |
41 | Correct | 52 ms | 852 KB | Output is correct |
42 | Correct | 23 ms | 688 KB | Output is correct |
43 | Correct | 44 ms | 1148 KB | Output is correct |
44 | Correct | 41 ms | 1140 KB | Output is correct |
45 | Correct | 41 ms | 1104 KB | Output is correct |
46 | Correct | 23 ms | 584 KB | Output is correct |
47 | Correct | 24 ms | 712 KB | Output is correct |
48 | Correct | 45 ms | 1072 KB | Output is correct |
49 | Correct | 42 ms | 812 KB | Output is correct |
50 | Correct | 24 ms | 720 KB | Output is correct |
51 | Correct | 4 ms | 340 KB | Output is correct |
52 | Correct | 57 ms | 1252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 340 KB | Output is correct |
26 | Correct | 4 ms | 568 KB | Output is correct |
27 | Correct | 3 ms | 340 KB | Output is correct |
28 | Correct | 3 ms | 340 KB | Output is correct |
29 | Correct | 3 ms | 340 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 340 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 4 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 340 KB | Output is correct |
35 | Correct | 3 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
37 | Correct | 12 ms | 596 KB | Output is correct |
38 | Correct | 14 ms | 596 KB | Output is correct |
39 | Correct | 41 ms | 724 KB | Output is correct |
40 | Correct | 26 ms | 708 KB | Output is correct |
41 | Correct | 52 ms | 852 KB | Output is correct |
42 | Correct | 23 ms | 688 KB | Output is correct |
43 | Correct | 44 ms | 1148 KB | Output is correct |
44 | Correct | 41 ms | 1140 KB | Output is correct |
45 | Correct | 41 ms | 1104 KB | Output is correct |
46 | Correct | 23 ms | 584 KB | Output is correct |
47 | Correct | 24 ms | 712 KB | Output is correct |
48 | Correct | 45 ms | 1072 KB | Output is correct |
49 | Correct | 42 ms | 812 KB | Output is correct |
50 | Correct | 24 ms | 720 KB | Output is correct |
51 | Correct | 4 ms | 340 KB | Output is correct |
52 | Correct | 57 ms | 1252 KB | Output is correct |
53 | Correct | 52 ms | 972 KB | Output is correct |
54 | Correct | 58 ms | 1140 KB | Output is correct |
55 | Correct | 110 ms | 1724 KB | Output is correct |
56 | Correct | 52 ms | 1140 KB | Output is correct |
57 | Correct | 117 ms | 1876 KB | Output is correct |
58 | Correct | 64 ms | 1196 KB | Output is correct |
59 | Correct | 77 ms | 1300 KB | Output is correct |
60 | Correct | 11 ms | 572 KB | Output is correct |
61 | Correct | 89 ms | 1508 KB | Output is correct |
62 | Correct | 87 ms | 1672 KB | Output is correct |
63 | Correct | 100 ms | 1652 KB | Output is correct |
64 | Correct | 123 ms | 1636 KB | Output is correct |
65 | Correct | 44 ms | 712 KB | Output is correct |
66 | Correct | 43 ms | 792 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 0 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 3 ms | 340 KB | Output is correct |
26 | Correct | 4 ms | 568 KB | Output is correct |
27 | Correct | 3 ms | 340 KB | Output is correct |
28 | Correct | 3 ms | 340 KB | Output is correct |
29 | Correct | 3 ms | 340 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 3 ms | 340 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 4 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 340 KB | Output is correct |
35 | Correct | 3 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
37 | Correct | 12 ms | 596 KB | Output is correct |
38 | Correct | 14 ms | 596 KB | Output is correct |
39 | Correct | 41 ms | 724 KB | Output is correct |
40 | Correct | 26 ms | 708 KB | Output is correct |
41 | Correct | 52 ms | 852 KB | Output is correct |
42 | Correct | 23 ms | 688 KB | Output is correct |
43 | Correct | 44 ms | 1148 KB | Output is correct |
44 | Correct | 41 ms | 1140 KB | Output is correct |
45 | Correct | 41 ms | 1104 KB | Output is correct |
46 | Correct | 23 ms | 584 KB | Output is correct |
47 | Correct | 24 ms | 712 KB | Output is correct |
48 | Correct | 45 ms | 1072 KB | Output is correct |
49 | Correct | 42 ms | 812 KB | Output is correct |
50 | Correct | 24 ms | 720 KB | Output is correct |
51 | Correct | 4 ms | 340 KB | Output is correct |
52 | Correct | 57 ms | 1252 KB | Output is correct |
53 | Correct | 52 ms | 972 KB | Output is correct |
54 | Correct | 58 ms | 1140 KB | Output is correct |
55 | Correct | 110 ms | 1724 KB | Output is correct |
56 | Correct | 52 ms | 1140 KB | Output is correct |
57 | Correct | 117 ms | 1876 KB | Output is correct |
58 | Correct | 64 ms | 1196 KB | Output is correct |
59 | Correct | 77 ms | 1300 KB | Output is correct |
60 | Correct | 11 ms | 572 KB | Output is correct |
61 | Correct | 89 ms | 1508 KB | Output is correct |
62 | Correct | 87 ms | 1672 KB | Output is correct |
63 | Correct | 100 ms | 1652 KB | Output is correct |
64 | Correct | 123 ms | 1636 KB | Output is correct |
65 | Correct | 44 ms | 712 KB | Output is correct |
66 | Correct | 43 ms | 792 KB | Output is correct |
67 | Correct | 91 ms | 1468 KB | Output is correct |
68 | Correct | 32 ms | 804 KB | Output is correct |
69 | Correct | 342 ms | 3136 KB | Output is correct |
70 | Correct | 205 ms | 2096 KB | Output is correct |
71 | Correct | 181 ms | 2064 KB | Output is correct |
72 | Correct | 178 ms | 1192 KB | Output is correct |
73 | Correct | 171 ms | 1304 KB | Output is correct |
74 | Correct | 325 ms | 3236 KB | Output is correct |
75 | Correct | 259 ms | 2668 KB | Output is correct |
76 | Correct | 363 ms | 3464 KB | Output is correct |
77 | Correct | 339 ms | 3404 KB | Output is correct |