# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
681998 | 2023-01-15T07:01:54 Z | boykut | Bootfall (IZhO17_bootfall) | C++14 | 334 ms | 3432 KB |
#include <bits/stdc++.h> using namespace std; const int MAX = 600; 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++) { 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
# | 결과 | 실행 시간 | 메모리 | 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 | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 2 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 | 328 KB | Output is correct |
25 | Correct | 3 ms | 464 KB | Output is correct |
26 | Correct | 4 ms | 468 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 | 468 KB | Output is correct |
33 | Correct | 3 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 332 KB | Output is correct |
35 | Correct | 3 ms | 340 KB | Output is correct |
36 | Correct | 2 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 2 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 | 328 KB | Output is correct |
25 | Correct | 3 ms | 464 KB | Output is correct |
26 | Correct | 4 ms | 468 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 | 468 KB | Output is correct |
33 | Correct | 3 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 332 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 | 620 KB | Output is correct |
38 | Correct | 13 ms | 624 KB | Output is correct |
39 | Correct | 41 ms | 844 KB | Output is correct |
40 | Correct | 25 ms | 708 KB | Output is correct |
41 | Correct | 55 ms | 892 KB | Output is correct |
42 | Correct | 22 ms | 688 KB | Output is correct |
43 | Correct | 38 ms | 1100 KB | Output is correct |
44 | Correct | 41 ms | 1032 KB | Output is correct |
45 | Correct | 41 ms | 1052 KB | Output is correct |
46 | Correct | 25 ms | 468 KB | Output is correct |
47 | Correct | 24 ms | 708 KB | Output is correct |
48 | Correct | 43 ms | 1052 KB | Output is correct |
49 | Correct | 43 ms | 816 KB | Output is correct |
50 | Correct | 27 ms | 716 KB | Output is correct |
51 | Correct | 5 ms | 340 KB | Output is correct |
52 | Correct | 54 ms | 1268 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 2 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 | 328 KB | Output is correct |
25 | Correct | 3 ms | 464 KB | Output is correct |
26 | Correct | 4 ms | 468 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 | 468 KB | Output is correct |
33 | Correct | 3 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 332 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 | 620 KB | Output is correct |
38 | Correct | 13 ms | 624 KB | Output is correct |
39 | Correct | 41 ms | 844 KB | Output is correct |
40 | Correct | 25 ms | 708 KB | Output is correct |
41 | Correct | 55 ms | 892 KB | Output is correct |
42 | Correct | 22 ms | 688 KB | Output is correct |
43 | Correct | 38 ms | 1100 KB | Output is correct |
44 | Correct | 41 ms | 1032 KB | Output is correct |
45 | Correct | 41 ms | 1052 KB | Output is correct |
46 | Correct | 25 ms | 468 KB | Output is correct |
47 | Correct | 24 ms | 708 KB | Output is correct |
48 | Correct | 43 ms | 1052 KB | Output is correct |
49 | Correct | 43 ms | 816 KB | Output is correct |
50 | Correct | 27 ms | 716 KB | Output is correct |
51 | Correct | 5 ms | 340 KB | Output is correct |
52 | Correct | 54 ms | 1268 KB | Output is correct |
53 | Correct | 49 ms | 972 KB | Output is correct |
54 | Correct | 63 ms | 1136 KB | Output is correct |
55 | Correct | 104 ms | 1800 KB | Output is correct |
56 | Correct | 50 ms | 1140 KB | Output is correct |
57 | Correct | 137 ms | 1812 KB | Output is correct |
58 | Correct | 59 ms | 1188 KB | Output is correct |
59 | Correct | 73 ms | 1360 KB | Output is correct |
60 | Correct | 10 ms | 468 KB | Output is correct |
61 | Correct | 83 ms | 1500 KB | Output is correct |
62 | Correct | 84 ms | 1588 KB | Output is correct |
63 | Correct | 98 ms | 1656 KB | Output is correct |
64 | Correct | 93 ms | 1636 KB | Output is correct |
65 | Correct | 42 ms | 708 KB | Output is correct |
66 | Correct | 43 ms | 744 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 212 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 340 KB | Output is correct |
21 | Correct | 2 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 | 328 KB | Output is correct |
25 | Correct | 3 ms | 464 KB | Output is correct |
26 | Correct | 4 ms | 468 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 | 468 KB | Output is correct |
33 | Correct | 3 ms | 340 KB | Output is correct |
34 | Correct | 3 ms | 332 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 | 620 KB | Output is correct |
38 | Correct | 13 ms | 624 KB | Output is correct |
39 | Correct | 41 ms | 844 KB | Output is correct |
40 | Correct | 25 ms | 708 KB | Output is correct |
41 | Correct | 55 ms | 892 KB | Output is correct |
42 | Correct | 22 ms | 688 KB | Output is correct |
43 | Correct | 38 ms | 1100 KB | Output is correct |
44 | Correct | 41 ms | 1032 KB | Output is correct |
45 | Correct | 41 ms | 1052 KB | Output is correct |
46 | Correct | 25 ms | 468 KB | Output is correct |
47 | Correct | 24 ms | 708 KB | Output is correct |
48 | Correct | 43 ms | 1052 KB | Output is correct |
49 | Correct | 43 ms | 816 KB | Output is correct |
50 | Correct | 27 ms | 716 KB | Output is correct |
51 | Correct | 5 ms | 340 KB | Output is correct |
52 | Correct | 54 ms | 1268 KB | Output is correct |
53 | Correct | 49 ms | 972 KB | Output is correct |
54 | Correct | 63 ms | 1136 KB | Output is correct |
55 | Correct | 104 ms | 1800 KB | Output is correct |
56 | Correct | 50 ms | 1140 KB | Output is correct |
57 | Correct | 137 ms | 1812 KB | Output is correct |
58 | Correct | 59 ms | 1188 KB | Output is correct |
59 | Correct | 73 ms | 1360 KB | Output is correct |
60 | Correct | 10 ms | 468 KB | Output is correct |
61 | Correct | 83 ms | 1500 KB | Output is correct |
62 | Correct | 84 ms | 1588 KB | Output is correct |
63 | Correct | 98 ms | 1656 KB | Output is correct |
64 | Correct | 93 ms | 1636 KB | Output is correct |
65 | Correct | 42 ms | 708 KB | Output is correct |
66 | Correct | 43 ms | 744 KB | Output is correct |
67 | Correct | 91 ms | 1540 KB | Output is correct |
68 | Correct | 30 ms | 736 KB | Output is correct |
69 | Correct | 293 ms | 3208 KB | Output is correct |
70 | Correct | 172 ms | 2120 KB | Output is correct |
71 | Correct | 187 ms | 1976 KB | Output is correct |
72 | Correct | 161 ms | 1300 KB | Output is correct |
73 | Correct | 162 ms | 1296 KB | Output is correct |
74 | Correct | 300 ms | 3240 KB | Output is correct |
75 | Correct | 229 ms | 2716 KB | Output is correct |
76 | Correct | 334 ms | 3380 KB | Output is correct |
77 | Correct | 326 ms | 3432 KB | Output is correct |