# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337942 | 2020-12-22T06:52:27 Z | kutbilim_one | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 5848 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 */ const int MAX = 500*500+1; signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n); vector<int> dp(MAX); vector<int> used(MAX, 1); dp[0] = 1; int sum = 0; for(int i = 0; i < n; i++){ cin >> a[i]; for(int x = sum; x >= 0; x--) dp[x+a[i]] += dp[x]; sum += a[i]; } 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4332 KB | Output is correct |
2 | Correct | 6 ms | 4204 KB | Output is correct |
3 | Correct | 3 ms | 4204 KB | Output is correct |
4 | Correct | 5 ms | 4204 KB | Output is correct |
5 | Correct | 8 ms | 4204 KB | Output is correct |
6 | Correct | 6 ms | 4204 KB | Output is correct |
7 | Correct | 5 ms | 4204 KB | Output is correct |
8 | Correct | 7 ms | 4204 KB | Output is correct |
9 | Correct | 6 ms | 4204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4332 KB | Output is correct |
2 | Correct | 6 ms | 4204 KB | Output is correct |
3 | Correct | 3 ms | 4204 KB | Output is correct |
4 | Correct | 5 ms | 4204 KB | Output is correct |
5 | Correct | 8 ms | 4204 KB | Output is correct |
6 | Correct | 6 ms | 4204 KB | Output is correct |
7 | Correct | 5 ms | 4204 KB | Output is correct |
8 | Correct | 7 ms | 4204 KB | Output is correct |
9 | Correct | 6 ms | 4204 KB | Output is correct |
10 | Correct | 12 ms | 4204 KB | Output is correct |
11 | Correct | 13 ms | 4204 KB | Output is correct |
12 | Correct | 13 ms | 4204 KB | Output is correct |
13 | Correct | 11 ms | 4204 KB | Output is correct |
14 | Correct | 12 ms | 4204 KB | Output is correct |
15 | Correct | 12 ms | 4204 KB | Output is correct |
16 | Correct | 12 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 10 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 13 ms | 4204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4332 KB | Output is correct |
2 | Correct | 6 ms | 4204 KB | Output is correct |
3 | Correct | 3 ms | 4204 KB | Output is correct |
4 | Correct | 5 ms | 4204 KB | Output is correct |
5 | Correct | 8 ms | 4204 KB | Output is correct |
6 | Correct | 6 ms | 4204 KB | Output is correct |
7 | Correct | 5 ms | 4204 KB | Output is correct |
8 | Correct | 7 ms | 4204 KB | Output is correct |
9 | Correct | 6 ms | 4204 KB | Output is correct |
10 | Correct | 12 ms | 4204 KB | Output is correct |
11 | Correct | 13 ms | 4204 KB | Output is correct |
12 | Correct | 13 ms | 4204 KB | Output is correct |
13 | Correct | 11 ms | 4204 KB | Output is correct |
14 | Correct | 12 ms | 4204 KB | Output is correct |
15 | Correct | 12 ms | 4204 KB | Output is correct |
16 | Correct | 12 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 10 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 13 ms | 4204 KB | Output is correct |
21 | Correct | 24 ms | 4332 KB | Output is correct |
22 | Correct | 27 ms | 4332 KB | Output is correct |
23 | Correct | 19 ms | 4332 KB | Output is correct |
24 | Correct | 43 ms | 4332 KB | Output is correct |
25 | Correct | 39 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4332 KB | Output is correct |
27 | Correct | 44 ms | 4332 KB | Output is correct |
28 | Correct | 41 ms | 4332 KB | Output is correct |
29 | Correct | 41 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 39 ms | 4332 KB | Output is correct |
32 | Correct | 37 ms | 4332 KB | Output is correct |
33 | Correct | 41 ms | 4204 KB | Output is correct |
34 | Correct | 42 ms | 4204 KB | Output is correct |
35 | Correct | 43 ms | 4204 KB | Output is correct |
36 | Correct | 37 ms | 4332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4332 KB | Output is correct |
2 | Correct | 6 ms | 4204 KB | Output is correct |
3 | Correct | 3 ms | 4204 KB | Output is correct |
4 | Correct | 5 ms | 4204 KB | Output is correct |
5 | Correct | 8 ms | 4204 KB | Output is correct |
6 | Correct | 6 ms | 4204 KB | Output is correct |
7 | Correct | 5 ms | 4204 KB | Output is correct |
8 | Correct | 7 ms | 4204 KB | Output is correct |
9 | Correct | 6 ms | 4204 KB | Output is correct |
10 | Correct | 12 ms | 4204 KB | Output is correct |
11 | Correct | 13 ms | 4204 KB | Output is correct |
12 | Correct | 13 ms | 4204 KB | Output is correct |
13 | Correct | 11 ms | 4204 KB | Output is correct |
14 | Correct | 12 ms | 4204 KB | Output is correct |
15 | Correct | 12 ms | 4204 KB | Output is correct |
16 | Correct | 12 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 10 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 13 ms | 4204 KB | Output is correct |
21 | Correct | 24 ms | 4332 KB | Output is correct |
22 | Correct | 27 ms | 4332 KB | Output is correct |
23 | Correct | 19 ms | 4332 KB | Output is correct |
24 | Correct | 43 ms | 4332 KB | Output is correct |
25 | Correct | 39 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4332 KB | Output is correct |
27 | Correct | 44 ms | 4332 KB | Output is correct |
28 | Correct | 41 ms | 4332 KB | Output is correct |
29 | Correct | 41 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 39 ms | 4332 KB | Output is correct |
32 | Correct | 37 ms | 4332 KB | Output is correct |
33 | Correct | 41 ms | 4204 KB | Output is correct |
34 | Correct | 42 ms | 4204 KB | Output is correct |
35 | Correct | 43 ms | 4204 KB | Output is correct |
36 | Correct | 37 ms | 4332 KB | Output is correct |
37 | Correct | 95 ms | 4460 KB | Output is correct |
38 | Correct | 103 ms | 4480 KB | Output is correct |
39 | Correct | 200 ms | 4332 KB | Output is correct |
40 | Correct | 157 ms | 4588 KB | Output is correct |
41 | Correct | 246 ms | 4204 KB | Output is correct |
42 | Correct | 143 ms | 4588 KB | Output is correct |
43 | Correct | 191 ms | 4716 KB | Output is correct |
44 | Correct | 196 ms | 4716 KB | Output is correct |
45 | Correct | 197 ms | 4692 KB | Output is correct |
46 | Correct | 153 ms | 4204 KB | Output is correct |
47 | Correct | 145 ms | 4588 KB | Output is correct |
48 | Correct | 210 ms | 4588 KB | Output is correct |
49 | Correct | 208 ms | 4332 KB | Output is correct |
50 | Correct | 147 ms | 4588 KB | Output is correct |
51 | Correct | 17 ms | 4204 KB | Output is correct |
52 | Correct | 248 ms | 4844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4332 KB | Output is correct |
2 | Correct | 6 ms | 4204 KB | Output is correct |
3 | Correct | 3 ms | 4204 KB | Output is correct |
4 | Correct | 5 ms | 4204 KB | Output is correct |
5 | Correct | 8 ms | 4204 KB | Output is correct |
6 | Correct | 6 ms | 4204 KB | Output is correct |
7 | Correct | 5 ms | 4204 KB | Output is correct |
8 | Correct | 7 ms | 4204 KB | Output is correct |
9 | Correct | 6 ms | 4204 KB | Output is correct |
10 | Correct | 12 ms | 4204 KB | Output is correct |
11 | Correct | 13 ms | 4204 KB | Output is correct |
12 | Correct | 13 ms | 4204 KB | Output is correct |
13 | Correct | 11 ms | 4204 KB | Output is correct |
14 | Correct | 12 ms | 4204 KB | Output is correct |
15 | Correct | 12 ms | 4204 KB | Output is correct |
16 | Correct | 12 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 10 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 13 ms | 4204 KB | Output is correct |
21 | Correct | 24 ms | 4332 KB | Output is correct |
22 | Correct | 27 ms | 4332 KB | Output is correct |
23 | Correct | 19 ms | 4332 KB | Output is correct |
24 | Correct | 43 ms | 4332 KB | Output is correct |
25 | Correct | 39 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4332 KB | Output is correct |
27 | Correct | 44 ms | 4332 KB | Output is correct |
28 | Correct | 41 ms | 4332 KB | Output is correct |
29 | Correct | 41 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 39 ms | 4332 KB | Output is correct |
32 | Correct | 37 ms | 4332 KB | Output is correct |
33 | Correct | 41 ms | 4204 KB | Output is correct |
34 | Correct | 42 ms | 4204 KB | Output is correct |
35 | Correct | 43 ms | 4204 KB | Output is correct |
36 | Correct | 37 ms | 4332 KB | Output is correct |
37 | Correct | 95 ms | 4460 KB | Output is correct |
38 | Correct | 103 ms | 4480 KB | Output is correct |
39 | Correct | 200 ms | 4332 KB | Output is correct |
40 | Correct | 157 ms | 4588 KB | Output is correct |
41 | Correct | 246 ms | 4204 KB | Output is correct |
42 | Correct | 143 ms | 4588 KB | Output is correct |
43 | Correct | 191 ms | 4716 KB | Output is correct |
44 | Correct | 196 ms | 4716 KB | Output is correct |
45 | Correct | 197 ms | 4692 KB | Output is correct |
46 | Correct | 153 ms | 4204 KB | Output is correct |
47 | Correct | 145 ms | 4588 KB | Output is correct |
48 | Correct | 210 ms | 4588 KB | Output is correct |
49 | Correct | 208 ms | 4332 KB | Output is correct |
50 | Correct | 147 ms | 4588 KB | Output is correct |
51 | Correct | 17 ms | 4204 KB | Output is correct |
52 | Correct | 248 ms | 4844 KB | Output is correct |
53 | Correct | 212 ms | 4696 KB | Output is correct |
54 | Correct | 269 ms | 4844 KB | Output is correct |
55 | Correct | 434 ms | 5096 KB | Output is correct |
56 | Correct | 237 ms | 4844 KB | Output is correct |
57 | Correct | 457 ms | 5096 KB | Output is correct |
58 | Correct | 289 ms | 4844 KB | Output is correct |
59 | Correct | 347 ms | 4952 KB | Output is correct |
60 | Correct | 36 ms | 4204 KB | Output is correct |
61 | Correct | 358 ms | 4968 KB | Output is correct |
62 | Correct | 360 ms | 5096 KB | Output is correct |
63 | Correct | 392 ms | 5096 KB | Output is correct |
64 | Correct | 367 ms | 5096 KB | Output is correct |
65 | Correct | 223 ms | 4332 KB | Output is correct |
66 | Correct | 233 ms | 4332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4332 KB | Output is correct |
2 | Correct | 6 ms | 4204 KB | Output is correct |
3 | Correct | 3 ms | 4204 KB | Output is correct |
4 | Correct | 5 ms | 4204 KB | Output is correct |
5 | Correct | 8 ms | 4204 KB | Output is correct |
6 | Correct | 6 ms | 4204 KB | Output is correct |
7 | Correct | 5 ms | 4204 KB | Output is correct |
8 | Correct | 7 ms | 4204 KB | Output is correct |
9 | Correct | 6 ms | 4204 KB | Output is correct |
10 | Correct | 12 ms | 4204 KB | Output is correct |
11 | Correct | 13 ms | 4204 KB | Output is correct |
12 | Correct | 13 ms | 4204 KB | Output is correct |
13 | Correct | 11 ms | 4204 KB | Output is correct |
14 | Correct | 12 ms | 4204 KB | Output is correct |
15 | Correct | 12 ms | 4204 KB | Output is correct |
16 | Correct | 12 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 10 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 13 ms | 4204 KB | Output is correct |
21 | Correct | 24 ms | 4332 KB | Output is correct |
22 | Correct | 27 ms | 4332 KB | Output is correct |
23 | Correct | 19 ms | 4332 KB | Output is correct |
24 | Correct | 43 ms | 4332 KB | Output is correct |
25 | Correct | 39 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4332 KB | Output is correct |
27 | Correct | 44 ms | 4332 KB | Output is correct |
28 | Correct | 41 ms | 4332 KB | Output is correct |
29 | Correct | 41 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 39 ms | 4332 KB | Output is correct |
32 | Correct | 37 ms | 4332 KB | Output is correct |
33 | Correct | 41 ms | 4204 KB | Output is correct |
34 | Correct | 42 ms | 4204 KB | Output is correct |
35 | Correct | 43 ms | 4204 KB | Output is correct |
36 | Correct | 37 ms | 4332 KB | Output is correct |
37 | Correct | 95 ms | 4460 KB | Output is correct |
38 | Correct | 103 ms | 4480 KB | Output is correct |
39 | Correct | 200 ms | 4332 KB | Output is correct |
40 | Correct | 157 ms | 4588 KB | Output is correct |
41 | Correct | 246 ms | 4204 KB | Output is correct |
42 | Correct | 143 ms | 4588 KB | Output is correct |
43 | Correct | 191 ms | 4716 KB | Output is correct |
44 | Correct | 196 ms | 4716 KB | Output is correct |
45 | Correct | 197 ms | 4692 KB | Output is correct |
46 | Correct | 153 ms | 4204 KB | Output is correct |
47 | Correct | 145 ms | 4588 KB | Output is correct |
48 | Correct | 210 ms | 4588 KB | Output is correct |
49 | Correct | 208 ms | 4332 KB | Output is correct |
50 | Correct | 147 ms | 4588 KB | Output is correct |
51 | Correct | 17 ms | 4204 KB | Output is correct |
52 | Correct | 248 ms | 4844 KB | Output is correct |
53 | Correct | 212 ms | 4696 KB | Output is correct |
54 | Correct | 269 ms | 4844 KB | Output is correct |
55 | Correct | 434 ms | 5096 KB | Output is correct |
56 | Correct | 237 ms | 4844 KB | Output is correct |
57 | Correct | 457 ms | 5096 KB | Output is correct |
58 | Correct | 289 ms | 4844 KB | Output is correct |
59 | Correct | 347 ms | 4952 KB | Output is correct |
60 | Correct | 36 ms | 4204 KB | Output is correct |
61 | Correct | 358 ms | 4968 KB | Output is correct |
62 | Correct | 360 ms | 5096 KB | Output is correct |
63 | Correct | 392 ms | 5096 KB | Output is correct |
64 | Correct | 367 ms | 5096 KB | Output is correct |
65 | Correct | 223 ms | 4332 KB | Output is correct |
66 | Correct | 233 ms | 4332 KB | Output is correct |
67 | Correct | 377 ms | 4968 KB | Output is correct |
68 | Correct | 101 ms | 4204 KB | Output is correct |
69 | Execution timed out | 1070 ms | 5848 KB | Time limit exceeded |
70 | Halted | 0 ms | 0 KB | - |