# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
337940 | 2020-12-22T06:45:28 Z | kutbilim_one | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 3692 KB |
/** kutbilim.one **/ #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() #define int long long #define endl '\n' /* ifstream in("test.txt"); #define cin in */ signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n); int sum = 0; for(int i = 0; i < n; i++) cin >> a[i], sum += a[i]; sort(all(a)); int MAX = sum; vector<int> dp(MAX+1); vector<int> used(MAX+1, 1); dp[0] = 1; for(int k = 0; k < n; k++){ for(int x = MAX-a[k]; x >= 0; x--){ dp[x+a[k]] += dp[x]; } } if(sum%2 == 1 || dp[sum/2] == 0) return cout << 0, 0; for(int ex = 0; ex < n; ex++){ int left = sum-a[ex]; for(int x = 0; x <= left; x++) dp[x + a[ex]] -= dp[x]; for(int right = 0; right <= MAX; right++) if((left+right)%2 == 1 || dp[(left+right)/2] == 0) used[right] = 0; for(int x = left; x >= 0; x--) dp[x + a[ex]] += dp[x]; } vector<int> res; for(int i = 0; i <= MAX; i++){ if(used[i]) res.push_back(i); } cout << res.size() << endl; for(auto i : res) cout << i << " "; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 3 ms | 364 KB | Output is correct |
22 | Correct | 4 ms | 492 KB | Output is correct |
23 | Correct | 2 ms | 364 KB | Output is correct |
24 | Correct | 6 ms | 492 KB | Output is correct |
25 | Correct | 11 ms | 492 KB | Output is correct |
26 | Correct | 12 ms | 620 KB | Output is correct |
27 | Correct | 11 ms | 492 KB | Output is correct |
28 | Correct | 11 ms | 492 KB | Output is correct |
29 | Correct | 13 ms | 620 KB | Output is correct |
30 | Correct | 7 ms | 364 KB | Output is correct |
31 | Correct | 10 ms | 620 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
33 | Correct | 12 ms | 492 KB | Output is correct |
34 | Correct | 12 ms | 492 KB | Output is correct |
35 | Correct | 12 ms | 492 KB | Output is correct |
36 | Correct | 6 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 3 ms | 364 KB | Output is correct |
22 | Correct | 4 ms | 492 KB | Output is correct |
23 | Correct | 2 ms | 364 KB | Output is correct |
24 | Correct | 6 ms | 492 KB | Output is correct |
25 | Correct | 11 ms | 492 KB | Output is correct |
26 | Correct | 12 ms | 620 KB | Output is correct |
27 | Correct | 11 ms | 492 KB | Output is correct |
28 | Correct | 11 ms | 492 KB | Output is correct |
29 | Correct | 13 ms | 620 KB | Output is correct |
30 | Correct | 7 ms | 364 KB | Output is correct |
31 | Correct | 10 ms | 620 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
33 | Correct | 12 ms | 492 KB | Output is correct |
34 | Correct | 12 ms | 492 KB | Output is correct |
35 | Correct | 12 ms | 492 KB | Output is correct |
36 | Correct | 6 ms | 492 KB | Output is correct |
37 | Correct | 47 ms | 876 KB | Output is correct |
38 | Correct | 45 ms | 956 KB | Output is correct |
39 | Correct | 175 ms | 1260 KB | Output is correct |
40 | Correct | 99 ms | 1260 KB | Output is correct |
41 | Correct | 223 ms | 1644 KB | Output is correct |
42 | Correct | 87 ms | 1132 KB | Output is correct |
43 | Correct | 156 ms | 1764 KB | Output is correct |
44 | Correct | 163 ms | 1772 KB | Output is correct |
45 | Correct | 151 ms | 1660 KB | Output is correct |
46 | Correct | 95 ms | 888 KB | Output is correct |
47 | Correct | 92 ms | 1260 KB | Output is correct |
48 | Correct | 178 ms | 1644 KB | Output is correct |
49 | Correct | 177 ms | 1516 KB | Output is correct |
50 | Correct | 93 ms | 1260 KB | Output is correct |
51 | Correct | 27 ms | 876 KB | Output is correct |
52 | Correct | 218 ms | 1900 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 3 ms | 364 KB | Output is correct |
22 | Correct | 4 ms | 492 KB | Output is correct |
23 | Correct | 2 ms | 364 KB | Output is correct |
24 | Correct | 6 ms | 492 KB | Output is correct |
25 | Correct | 11 ms | 492 KB | Output is correct |
26 | Correct | 12 ms | 620 KB | Output is correct |
27 | Correct | 11 ms | 492 KB | Output is correct |
28 | Correct | 11 ms | 492 KB | Output is correct |
29 | Correct | 13 ms | 620 KB | Output is correct |
30 | Correct | 7 ms | 364 KB | Output is correct |
31 | Correct | 10 ms | 620 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
33 | Correct | 12 ms | 492 KB | Output is correct |
34 | Correct | 12 ms | 492 KB | Output is correct |
35 | Correct | 12 ms | 492 KB | Output is correct |
36 | Correct | 6 ms | 492 KB | Output is correct |
37 | Correct | 47 ms | 876 KB | Output is correct |
38 | Correct | 45 ms | 956 KB | Output is correct |
39 | Correct | 175 ms | 1260 KB | Output is correct |
40 | Correct | 99 ms | 1260 KB | Output is correct |
41 | Correct | 223 ms | 1644 KB | Output is correct |
42 | Correct | 87 ms | 1132 KB | Output is correct |
43 | Correct | 156 ms | 1764 KB | Output is correct |
44 | Correct | 163 ms | 1772 KB | Output is correct |
45 | Correct | 151 ms | 1660 KB | Output is correct |
46 | Correct | 95 ms | 888 KB | Output is correct |
47 | Correct | 92 ms | 1260 KB | Output is correct |
48 | Correct | 178 ms | 1644 KB | Output is correct |
49 | Correct | 177 ms | 1516 KB | Output is correct |
50 | Correct | 93 ms | 1260 KB | Output is correct |
51 | Correct | 27 ms | 876 KB | Output is correct |
52 | Correct | 218 ms | 1900 KB | Output is correct |
53 | Correct | 160 ms | 1488 KB | Output is correct |
54 | Correct | 224 ms | 1772 KB | Output is correct |
55 | Correct | 441 ms | 2920 KB | Output is correct |
56 | Correct | 200 ms | 1776 KB | Output is correct |
57 | Correct | 466 ms | 3048 KB | Output is correct |
58 | Correct | 238 ms | 1900 KB | Output is correct |
59 | Correct | 311 ms | 2284 KB | Output is correct |
60 | Correct | 71 ms | 1260 KB | Output is correct |
61 | Correct | 349 ms | 2412 KB | Output is correct |
62 | Correct | 359 ms | 2664 KB | Output is correct |
63 | Correct | 383 ms | 2792 KB | Output is correct |
64 | Correct | 356 ms | 2792 KB | Output is correct |
65 | Correct | 176 ms | 1132 KB | Output is correct |
66 | Correct | 185 ms | 1260 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 3 ms | 364 KB | Output is correct |
22 | Correct | 4 ms | 492 KB | Output is correct |
23 | Correct | 2 ms | 364 KB | Output is correct |
24 | Correct | 6 ms | 492 KB | Output is correct |
25 | Correct | 11 ms | 492 KB | Output is correct |
26 | Correct | 12 ms | 620 KB | Output is correct |
27 | Correct | 11 ms | 492 KB | Output is correct |
28 | Correct | 11 ms | 492 KB | Output is correct |
29 | Correct | 13 ms | 620 KB | Output is correct |
30 | Correct | 7 ms | 364 KB | Output is correct |
31 | Correct | 10 ms | 620 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
33 | Correct | 12 ms | 492 KB | Output is correct |
34 | Correct | 12 ms | 492 KB | Output is correct |
35 | Correct | 12 ms | 492 KB | Output is correct |
36 | Correct | 6 ms | 492 KB | Output is correct |
37 | Correct | 47 ms | 876 KB | Output is correct |
38 | Correct | 45 ms | 956 KB | Output is correct |
39 | Correct | 175 ms | 1260 KB | Output is correct |
40 | Correct | 99 ms | 1260 KB | Output is correct |
41 | Correct | 223 ms | 1644 KB | Output is correct |
42 | Correct | 87 ms | 1132 KB | Output is correct |
43 | Correct | 156 ms | 1764 KB | Output is correct |
44 | Correct | 163 ms | 1772 KB | Output is correct |
45 | Correct | 151 ms | 1660 KB | Output is correct |
46 | Correct | 95 ms | 888 KB | Output is correct |
47 | Correct | 92 ms | 1260 KB | Output is correct |
48 | Correct | 178 ms | 1644 KB | Output is correct |
49 | Correct | 177 ms | 1516 KB | Output is correct |
50 | Correct | 93 ms | 1260 KB | Output is correct |
51 | Correct | 27 ms | 876 KB | Output is correct |
52 | Correct | 218 ms | 1900 KB | Output is correct |
53 | Correct | 160 ms | 1488 KB | Output is correct |
54 | Correct | 224 ms | 1772 KB | Output is correct |
55 | Correct | 441 ms | 2920 KB | Output is correct |
56 | Correct | 200 ms | 1776 KB | Output is correct |
57 | Correct | 466 ms | 3048 KB | Output is correct |
58 | Correct | 238 ms | 1900 KB | Output is correct |
59 | Correct | 311 ms | 2284 KB | Output is correct |
60 | Correct | 71 ms | 1260 KB | Output is correct |
61 | Correct | 349 ms | 2412 KB | Output is correct |
62 | Correct | 359 ms | 2664 KB | Output is correct |
63 | Correct | 383 ms | 2792 KB | Output is correct |
64 | Correct | 356 ms | 2792 KB | Output is correct |
65 | Correct | 176 ms | 1132 KB | Output is correct |
66 | Correct | 185 ms | 1260 KB | Output is correct |
67 | Correct | 371 ms | 2284 KB | Output is correct |
68 | Correct | 205 ms | 2284 KB | Output is correct |
69 | Execution timed out | 1091 ms | 3692 KB | Time limit exceeded |
70 | Halted | 0 ms | 0 KB | - |