# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
169774 | 2019-12-22T20:06:46 Z | super_j6 | Bootfall (IZhO17_bootfall) | C++14 | 604 ms | 38236 KB |
#include <iostream> #include <cstdio> #include <algorithm> #include <set> #include <vector> using namespace std; #define endl '\n' #define pi pair<int, int> const int maxn = 500, m = 250001; int n; int a[maxn], dp[m]; set<int> cur; int s; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n; dp[0] = 1; for(int i = 0; i < n; i++){ cin >> a[i]; s += a[i]; for(int j = m - a[i] - 1; j >= 0; j--){ dp[j + a[i]] += dp[j]; } } if(s % 2 || !dp[s / 2]){ cout << 0 << endl; cout << endl; return 0; } for(int i = 1; i < 3 * m / 2; i++) cur.insert(i); for(int i = 0; i < n; i++){ for(int j = 0; j < m - a[i]; j++){ dp[j + a[i]] -= dp[j]; } for(auto it = cur.begin(); it != cur.end();){ int x = *it; it++; if((s - a[i] + x) % 2 || !dp[(s - a[i] + x) / 2]) cur.erase(x); } for(int j = m - a[i] - 1; j >= 0; j--){ dp[j + a[i]] += dp[j]; } } vector<int> ans; for(auto it = cur.begin(); it != cur.end(); it++) ans.push_back(*it); cout << ans.size() << endl; if(!ans.empty()){ cout << ans[0]; for(int i = 1; i < ans.size(); i++) cout << " " << ans[i]; } cout << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 19064 KB | Output is correct |
2 | Correct | 163 ms | 18868 KB | Output is correct |
3 | Correct | 4 ms | 1272 KB | Output is correct |
4 | Correct | 160 ms | 19064 KB | Output is correct |
5 | Correct | 180 ms | 18992 KB | Output is correct |
6 | Correct | 170 ms | 19064 KB | Output is correct |
7 | Correct | 163 ms | 18888 KB | Output is correct |
8 | Correct | 170 ms | 18936 KB | Output is correct |
9 | Correct | 172 ms | 18972 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 19064 KB | Output is correct |
2 | Correct | 163 ms | 18868 KB | Output is correct |
3 | Correct | 4 ms | 1272 KB | Output is correct |
4 | Correct | 160 ms | 19064 KB | Output is correct |
5 | Correct | 180 ms | 18992 KB | Output is correct |
6 | Correct | 170 ms | 19064 KB | Output is correct |
7 | Correct | 163 ms | 18888 KB | Output is correct |
8 | Correct | 170 ms | 18936 KB | Output is correct |
9 | Correct | 172 ms | 18972 KB | Output is correct |
10 | Correct | 175 ms | 19012 KB | Output is correct |
11 | Correct | 181 ms | 18936 KB | Output is correct |
12 | Correct | 177 ms | 18876 KB | Output is correct |
13 | Correct | 174 ms | 18976 KB | Output is correct |
14 | Correct | 182 ms | 18936 KB | Output is correct |
15 | Correct | 181 ms | 18852 KB | Output is correct |
16 | Correct | 184 ms | 18928 KB | Output is correct |
17 | Correct | 177 ms | 18948 KB | Output is correct |
18 | Correct | 181 ms | 18900 KB | Output is correct |
19 | Correct | 180 ms | 19000 KB | Output is correct |
20 | Correct | 176 ms | 18936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 19064 KB | Output is correct |
2 | Correct | 163 ms | 18868 KB | Output is correct |
3 | Correct | 4 ms | 1272 KB | Output is correct |
4 | Correct | 160 ms | 19064 KB | Output is correct |
5 | Correct | 180 ms | 18992 KB | Output is correct |
6 | Correct | 170 ms | 19064 KB | Output is correct |
7 | Correct | 163 ms | 18888 KB | Output is correct |
8 | Correct | 170 ms | 18936 KB | Output is correct |
9 | Correct | 172 ms | 18972 KB | Output is correct |
10 | Correct | 175 ms | 19012 KB | Output is correct |
11 | Correct | 181 ms | 18936 KB | Output is correct |
12 | Correct | 177 ms | 18876 KB | Output is correct |
13 | Correct | 174 ms | 18976 KB | Output is correct |
14 | Correct | 182 ms | 18936 KB | Output is correct |
15 | Correct | 181 ms | 18852 KB | Output is correct |
16 | Correct | 184 ms | 18928 KB | Output is correct |
17 | Correct | 177 ms | 18948 KB | Output is correct |
18 | Correct | 181 ms | 18900 KB | Output is correct |
19 | Correct | 180 ms | 19000 KB | Output is correct |
20 | Correct | 176 ms | 18936 KB | Output is correct |
21 | Correct | 208 ms | 19016 KB | Output is correct |
22 | Correct | 209 ms | 18936 KB | Output is correct |
23 | Correct | 198 ms | 18940 KB | Output is correct |
24 | Correct | 223 ms | 19012 KB | Output is correct |
25 | Correct | 223 ms | 19036 KB | Output is correct |
26 | Correct | 224 ms | 18936 KB | Output is correct |
27 | Correct | 220 ms | 18868 KB | Output is correct |
28 | Correct | 220 ms | 19036 KB | Output is correct |
29 | Correct | 222 ms | 19064 KB | Output is correct |
30 | Correct | 226 ms | 18936 KB | Output is correct |
31 | Correct | 224 ms | 18976 KB | Output is correct |
32 | Correct | 225 ms | 19064 KB | Output is correct |
33 | Correct | 214 ms | 18912 KB | Output is correct |
34 | Correct | 217 ms | 18960 KB | Output is correct |
35 | Correct | 285 ms | 18908 KB | Output is correct |
36 | Correct | 249 ms | 18908 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 19064 KB | Output is correct |
2 | Correct | 163 ms | 18868 KB | Output is correct |
3 | Correct | 4 ms | 1272 KB | Output is correct |
4 | Correct | 160 ms | 19064 KB | Output is correct |
5 | Correct | 180 ms | 18992 KB | Output is correct |
6 | Correct | 170 ms | 19064 KB | Output is correct |
7 | Correct | 163 ms | 18888 KB | Output is correct |
8 | Correct | 170 ms | 18936 KB | Output is correct |
9 | Correct | 172 ms | 18972 KB | Output is correct |
10 | Correct | 175 ms | 19012 KB | Output is correct |
11 | Correct | 181 ms | 18936 KB | Output is correct |
12 | Correct | 177 ms | 18876 KB | Output is correct |
13 | Correct | 174 ms | 18976 KB | Output is correct |
14 | Correct | 182 ms | 18936 KB | Output is correct |
15 | Correct | 181 ms | 18852 KB | Output is correct |
16 | Correct | 184 ms | 18928 KB | Output is correct |
17 | Correct | 177 ms | 18948 KB | Output is correct |
18 | Correct | 181 ms | 18900 KB | Output is correct |
19 | Correct | 180 ms | 19000 KB | Output is correct |
20 | Correct | 176 ms | 18936 KB | Output is correct |
21 | Correct | 208 ms | 19016 KB | Output is correct |
22 | Correct | 209 ms | 18936 KB | Output is correct |
23 | Correct | 198 ms | 18940 KB | Output is correct |
24 | Correct | 223 ms | 19012 KB | Output is correct |
25 | Correct | 223 ms | 19036 KB | Output is correct |
26 | Correct | 224 ms | 18936 KB | Output is correct |
27 | Correct | 220 ms | 18868 KB | Output is correct |
28 | Correct | 220 ms | 19036 KB | Output is correct |
29 | Correct | 222 ms | 19064 KB | Output is correct |
30 | Correct | 226 ms | 18936 KB | Output is correct |
31 | Correct | 224 ms | 18976 KB | Output is correct |
32 | Correct | 225 ms | 19064 KB | Output is correct |
33 | Correct | 214 ms | 18912 KB | Output is correct |
34 | Correct | 217 ms | 18960 KB | Output is correct |
35 | Correct | 285 ms | 18908 KB | Output is correct |
36 | Correct | 249 ms | 18908 KB | Output is correct |
37 | Correct | 310 ms | 18908 KB | Output is correct |
38 | Correct | 303 ms | 19064 KB | Output is correct |
39 | Correct | 286 ms | 18936 KB | Output is correct |
40 | Correct | 364 ms | 19024 KB | Output is correct |
41 | Correct | 303 ms | 18936 KB | Output is correct |
42 | Correct | 347 ms | 18980 KB | Output is correct |
43 | Correct | 380 ms | 19064 KB | Output is correct |
44 | Correct | 396 ms | 18936 KB | Output is correct |
45 | Correct | 400 ms | 18996 KB | Output is correct |
46 | Correct | 301 ms | 18936 KB | Output is correct |
47 | Correct | 347 ms | 18940 KB | Output is correct |
48 | Correct | 360 ms | 18936 KB | Output is correct |
49 | Correct | 315 ms | 19044 KB | Output is correct |
50 | Correct | 348 ms | 19064 KB | Output is correct |
51 | Correct | 42 ms | 1272 KB | Output is correct |
52 | Correct | 415 ms | 19068 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 19064 KB | Output is correct |
2 | Correct | 163 ms | 18868 KB | Output is correct |
3 | Correct | 4 ms | 1272 KB | Output is correct |
4 | Correct | 160 ms | 19064 KB | Output is correct |
5 | Correct | 180 ms | 18992 KB | Output is correct |
6 | Correct | 170 ms | 19064 KB | Output is correct |
7 | Correct | 163 ms | 18888 KB | Output is correct |
8 | Correct | 170 ms | 18936 KB | Output is correct |
9 | Correct | 172 ms | 18972 KB | Output is correct |
10 | Correct | 175 ms | 19012 KB | Output is correct |
11 | Correct | 181 ms | 18936 KB | Output is correct |
12 | Correct | 177 ms | 18876 KB | Output is correct |
13 | Correct | 174 ms | 18976 KB | Output is correct |
14 | Correct | 182 ms | 18936 KB | Output is correct |
15 | Correct | 181 ms | 18852 KB | Output is correct |
16 | Correct | 184 ms | 18928 KB | Output is correct |
17 | Correct | 177 ms | 18948 KB | Output is correct |
18 | Correct | 181 ms | 18900 KB | Output is correct |
19 | Correct | 180 ms | 19000 KB | Output is correct |
20 | Correct | 176 ms | 18936 KB | Output is correct |
21 | Correct | 208 ms | 19016 KB | Output is correct |
22 | Correct | 209 ms | 18936 KB | Output is correct |
23 | Correct | 198 ms | 18940 KB | Output is correct |
24 | Correct | 223 ms | 19012 KB | Output is correct |
25 | Correct | 223 ms | 19036 KB | Output is correct |
26 | Correct | 224 ms | 18936 KB | Output is correct |
27 | Correct | 220 ms | 18868 KB | Output is correct |
28 | Correct | 220 ms | 19036 KB | Output is correct |
29 | Correct | 222 ms | 19064 KB | Output is correct |
30 | Correct | 226 ms | 18936 KB | Output is correct |
31 | Correct | 224 ms | 18976 KB | Output is correct |
32 | Correct | 225 ms | 19064 KB | Output is correct |
33 | Correct | 214 ms | 18912 KB | Output is correct |
34 | Correct | 217 ms | 18960 KB | Output is correct |
35 | Correct | 285 ms | 18908 KB | Output is correct |
36 | Correct | 249 ms | 18908 KB | Output is correct |
37 | Correct | 310 ms | 18908 KB | Output is correct |
38 | Correct | 303 ms | 19064 KB | Output is correct |
39 | Correct | 286 ms | 18936 KB | Output is correct |
40 | Correct | 364 ms | 19024 KB | Output is correct |
41 | Correct | 303 ms | 18936 KB | Output is correct |
42 | Correct | 347 ms | 18980 KB | Output is correct |
43 | Correct | 380 ms | 19064 KB | Output is correct |
44 | Correct | 396 ms | 18936 KB | Output is correct |
45 | Correct | 400 ms | 18996 KB | Output is correct |
46 | Correct | 301 ms | 18936 KB | Output is correct |
47 | Correct | 347 ms | 18940 KB | Output is correct |
48 | Correct | 360 ms | 18936 KB | Output is correct |
49 | Correct | 315 ms | 19044 KB | Output is correct |
50 | Correct | 348 ms | 19064 KB | Output is correct |
51 | Correct | 42 ms | 1272 KB | Output is correct |
52 | Correct | 415 ms | 19068 KB | Output is correct |
53 | Correct | 412 ms | 19076 KB | Output is correct |
54 | Correct | 474 ms | 18936 KB | Output is correct |
55 | Correct | 585 ms | 18936 KB | Output is correct |
56 | Correct | 440 ms | 18936 KB | Output is correct |
57 | Correct | 604 ms | 19064 KB | Output is correct |
58 | Correct | 493 ms | 19008 KB | Output is correct |
59 | Correct | 532 ms | 18984 KB | Output is correct |
60 | Correct | 58 ms | 1272 KB | Output is correct |
61 | Correct | 545 ms | 19104 KB | Output is correct |
62 | Correct | 549 ms | 18956 KB | Output is correct |
63 | Correct | 544 ms | 18980 KB | Output is correct |
64 | Correct | 529 ms | 18936 KB | Output is correct |
65 | Correct | 324 ms | 18932 KB | Output is correct |
66 | Correct | 358 ms | 18936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 162 ms | 19064 KB | Output is correct |
2 | Correct | 163 ms | 18868 KB | Output is correct |
3 | Correct | 4 ms | 1272 KB | Output is correct |
4 | Correct | 160 ms | 19064 KB | Output is correct |
5 | Correct | 180 ms | 18992 KB | Output is correct |
6 | Correct | 170 ms | 19064 KB | Output is correct |
7 | Correct | 163 ms | 18888 KB | Output is correct |
8 | Correct | 170 ms | 18936 KB | Output is correct |
9 | Correct | 172 ms | 18972 KB | Output is correct |
10 | Correct | 175 ms | 19012 KB | Output is correct |
11 | Correct | 181 ms | 18936 KB | Output is correct |
12 | Correct | 177 ms | 18876 KB | Output is correct |
13 | Correct | 174 ms | 18976 KB | Output is correct |
14 | Correct | 182 ms | 18936 KB | Output is correct |
15 | Correct | 181 ms | 18852 KB | Output is correct |
16 | Correct | 184 ms | 18928 KB | Output is correct |
17 | Correct | 177 ms | 18948 KB | Output is correct |
18 | Correct | 181 ms | 18900 KB | Output is correct |
19 | Correct | 180 ms | 19000 KB | Output is correct |
20 | Correct | 176 ms | 18936 KB | Output is correct |
21 | Correct | 208 ms | 19016 KB | Output is correct |
22 | Correct | 209 ms | 18936 KB | Output is correct |
23 | Correct | 198 ms | 18940 KB | Output is correct |
24 | Correct | 223 ms | 19012 KB | Output is correct |
25 | Correct | 223 ms | 19036 KB | Output is correct |
26 | Correct | 224 ms | 18936 KB | Output is correct |
27 | Correct | 220 ms | 18868 KB | Output is correct |
28 | Correct | 220 ms | 19036 KB | Output is correct |
29 | Correct | 222 ms | 19064 KB | Output is correct |
30 | Correct | 226 ms | 18936 KB | Output is correct |
31 | Correct | 224 ms | 18976 KB | Output is correct |
32 | Correct | 225 ms | 19064 KB | Output is correct |
33 | Correct | 214 ms | 18912 KB | Output is correct |
34 | Correct | 217 ms | 18960 KB | Output is correct |
35 | Correct | 285 ms | 18908 KB | Output is correct |
36 | Correct | 249 ms | 18908 KB | Output is correct |
37 | Correct | 310 ms | 18908 KB | Output is correct |
38 | Correct | 303 ms | 19064 KB | Output is correct |
39 | Correct | 286 ms | 18936 KB | Output is correct |
40 | Correct | 364 ms | 19024 KB | Output is correct |
41 | Correct | 303 ms | 18936 KB | Output is correct |
42 | Correct | 347 ms | 18980 KB | Output is correct |
43 | Correct | 380 ms | 19064 KB | Output is correct |
44 | Correct | 396 ms | 18936 KB | Output is correct |
45 | Correct | 400 ms | 18996 KB | Output is correct |
46 | Correct | 301 ms | 18936 KB | Output is correct |
47 | Correct | 347 ms | 18940 KB | Output is correct |
48 | Correct | 360 ms | 18936 KB | Output is correct |
49 | Correct | 315 ms | 19044 KB | Output is correct |
50 | Correct | 348 ms | 19064 KB | Output is correct |
51 | Correct | 42 ms | 1272 KB | Output is correct |
52 | Correct | 415 ms | 19068 KB | Output is correct |
53 | Correct | 412 ms | 19076 KB | Output is correct |
54 | Correct | 474 ms | 18936 KB | Output is correct |
55 | Correct | 585 ms | 18936 KB | Output is correct |
56 | Correct | 440 ms | 18936 KB | Output is correct |
57 | Correct | 604 ms | 19064 KB | Output is correct |
58 | Correct | 493 ms | 19008 KB | Output is correct |
59 | Correct | 532 ms | 18984 KB | Output is correct |
60 | Correct | 58 ms | 1272 KB | Output is correct |
61 | Correct | 545 ms | 19104 KB | Output is correct |
62 | Correct | 549 ms | 18956 KB | Output is correct |
63 | Correct | 544 ms | 18980 KB | Output is correct |
64 | Correct | 529 ms | 18936 KB | Output is correct |
65 | Correct | 324 ms | 18932 KB | Output is correct |
66 | Correct | 358 ms | 18936 KB | Output is correct |
67 | Correct | 601 ms | 19068 KB | Output is correct |
68 | Correct | 81 ms | 1272 KB | Output is correct |
69 | Runtime error | 256 ms | 38236 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
70 | Halted | 0 ms | 0 KB | - |