# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337944 | 2020-12-22T06:54:29 Z | kutbilim_one | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 5844 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 | 4204 KB | Output is correct |
2 | Correct | 5 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 | 7 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 | 4204 KB | Output is correct |
2 | Correct | 5 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 | 7 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 | 12 ms | 4204 KB | Output is correct |
12 | Correct | 12 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 | 16 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 12 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 12 ms | 4204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4204 KB | Output is correct |
2 | Correct | 5 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 | 7 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 | 12 ms | 4204 KB | Output is correct |
12 | Correct | 12 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 | 16 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 12 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 12 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 | 20 ms | 4332 KB | Output is correct |
24 | Correct | 35 ms | 4332 KB | Output is correct |
25 | Correct | 41 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4308 KB | Output is correct |
27 | Correct | 40 ms | 4332 KB | Output is correct |
28 | Correct | 40 ms | 4332 KB | Output is correct |
29 | Correct | 42 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 41 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 | 41 ms | 4204 KB | Output is correct |
35 | Correct | 45 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 | 4204 KB | Output is correct |
2 | Correct | 5 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 | 7 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 | 12 ms | 4204 KB | Output is correct |
12 | Correct | 12 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 | 16 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 12 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 12 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 | 20 ms | 4332 KB | Output is correct |
24 | Correct | 35 ms | 4332 KB | Output is correct |
25 | Correct | 41 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4308 KB | Output is correct |
27 | Correct | 40 ms | 4332 KB | Output is correct |
28 | Correct | 40 ms | 4332 KB | Output is correct |
29 | Correct | 42 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 41 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 | 41 ms | 4204 KB | Output is correct |
35 | Correct | 45 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 | 96 ms | 4460 KB | Output is correct |
39 | Correct | 209 ms | 4204 KB | Output is correct |
40 | Correct | 159 ms | 4588 KB | Output is correct |
41 | Correct | 242 ms | 4204 KB | Output is correct |
42 | Correct | 144 ms | 4588 KB | Output is correct |
43 | Correct | 189 ms | 4716 KB | Output is correct |
44 | Correct | 196 ms | 4716 KB | Output is correct |
45 | Correct | 200 ms | 4716 KB | Output is correct |
46 | Correct | 150 ms | 4204 KB | Output is correct |
47 | Correct | 146 ms | 4612 KB | Output is correct |
48 | Correct | 204 ms | 4716 KB | Output is correct |
49 | Correct | 209 ms | 4332 KB | Output is correct |
50 | Correct | 149 ms | 4588 KB | Output is correct |
51 | Correct | 15 ms | 4204 KB | Output is correct |
52 | Correct | 245 ms | 4844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4204 KB | Output is correct |
2 | Correct | 5 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 | 7 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 | 12 ms | 4204 KB | Output is correct |
12 | Correct | 12 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 | 16 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 12 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 12 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 | 20 ms | 4332 KB | Output is correct |
24 | Correct | 35 ms | 4332 KB | Output is correct |
25 | Correct | 41 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4308 KB | Output is correct |
27 | Correct | 40 ms | 4332 KB | Output is correct |
28 | Correct | 40 ms | 4332 KB | Output is correct |
29 | Correct | 42 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 41 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 | 41 ms | 4204 KB | Output is correct |
35 | Correct | 45 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 | 96 ms | 4460 KB | Output is correct |
39 | Correct | 209 ms | 4204 KB | Output is correct |
40 | Correct | 159 ms | 4588 KB | Output is correct |
41 | Correct | 242 ms | 4204 KB | Output is correct |
42 | Correct | 144 ms | 4588 KB | Output is correct |
43 | Correct | 189 ms | 4716 KB | Output is correct |
44 | Correct | 196 ms | 4716 KB | Output is correct |
45 | Correct | 200 ms | 4716 KB | Output is correct |
46 | Correct | 150 ms | 4204 KB | Output is correct |
47 | Correct | 146 ms | 4612 KB | Output is correct |
48 | Correct | 204 ms | 4716 KB | Output is correct |
49 | Correct | 209 ms | 4332 KB | Output is correct |
50 | Correct | 149 ms | 4588 KB | Output is correct |
51 | Correct | 15 ms | 4204 KB | Output is correct |
52 | Correct | 245 ms | 4844 KB | Output is correct |
53 | Correct | 208 ms | 4716 KB | Output is correct |
54 | Correct | 272 ms | 4844 KB | Output is correct |
55 | Correct | 435 ms | 5096 KB | Output is correct |
56 | Correct | 238 ms | 4844 KB | Output is correct |
57 | Correct | 453 ms | 5076 KB | Output is correct |
58 | Correct | 292 ms | 4844 KB | Output is correct |
59 | Correct | 341 ms | 4972 KB | Output is correct |
60 | Correct | 36 ms | 4204 KB | Output is correct |
61 | Correct | 362 ms | 4972 KB | Output is correct |
62 | Correct | 363 ms | 5096 KB | Output is correct |
63 | Correct | 375 ms | 5244 KB | Output is correct |
64 | Correct | 357 ms | 5096 KB | Output is correct |
65 | Correct | 224 ms | 4332 KB | Output is correct |
66 | Correct | 230 ms | 4460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 4204 KB | Output is correct |
2 | Correct | 5 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 | 7 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 | 12 ms | 4204 KB | Output is correct |
12 | Correct | 12 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 | 16 ms | 4204 KB | Output is correct |
17 | Correct | 9 ms | 4204 KB | Output is correct |
18 | Correct | 12 ms | 4204 KB | Output is correct |
19 | Correct | 11 ms | 4204 KB | Output is correct |
20 | Correct | 12 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 | 20 ms | 4332 KB | Output is correct |
24 | Correct | 35 ms | 4332 KB | Output is correct |
25 | Correct | 41 ms | 4332 KB | Output is correct |
26 | Correct | 41 ms | 4308 KB | Output is correct |
27 | Correct | 40 ms | 4332 KB | Output is correct |
28 | Correct | 40 ms | 4332 KB | Output is correct |
29 | Correct | 42 ms | 4204 KB | Output is correct |
30 | Correct | 37 ms | 4204 KB | Output is correct |
31 | Correct | 41 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 | 41 ms | 4204 KB | Output is correct |
35 | Correct | 45 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 | 96 ms | 4460 KB | Output is correct |
39 | Correct | 209 ms | 4204 KB | Output is correct |
40 | Correct | 159 ms | 4588 KB | Output is correct |
41 | Correct | 242 ms | 4204 KB | Output is correct |
42 | Correct | 144 ms | 4588 KB | Output is correct |
43 | Correct | 189 ms | 4716 KB | Output is correct |
44 | Correct | 196 ms | 4716 KB | Output is correct |
45 | Correct | 200 ms | 4716 KB | Output is correct |
46 | Correct | 150 ms | 4204 KB | Output is correct |
47 | Correct | 146 ms | 4612 KB | Output is correct |
48 | Correct | 204 ms | 4716 KB | Output is correct |
49 | Correct | 209 ms | 4332 KB | Output is correct |
50 | Correct | 149 ms | 4588 KB | Output is correct |
51 | Correct | 15 ms | 4204 KB | Output is correct |
52 | Correct | 245 ms | 4844 KB | Output is correct |
53 | Correct | 208 ms | 4716 KB | Output is correct |
54 | Correct | 272 ms | 4844 KB | Output is correct |
55 | Correct | 435 ms | 5096 KB | Output is correct |
56 | Correct | 238 ms | 4844 KB | Output is correct |
57 | Correct | 453 ms | 5076 KB | Output is correct |
58 | Correct | 292 ms | 4844 KB | Output is correct |
59 | Correct | 341 ms | 4972 KB | Output is correct |
60 | Correct | 36 ms | 4204 KB | Output is correct |
61 | Correct | 362 ms | 4972 KB | Output is correct |
62 | Correct | 363 ms | 5096 KB | Output is correct |
63 | Correct | 375 ms | 5244 KB | Output is correct |
64 | Correct | 357 ms | 5096 KB | Output is correct |
65 | Correct | 224 ms | 4332 KB | Output is correct |
66 | Correct | 230 ms | 4460 KB | Output is correct |
67 | Correct | 373 ms | 4972 KB | Output is correct |
68 | Correct | 102 ms | 4332 KB | Output is correct |
69 | Execution timed out | 1042 ms | 5844 KB | Time limit exceeded |
70 | Halted | 0 ms | 0 KB | - |