# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38257 | 2018-01-03T08:43:51 Z | antimirage | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 22464 KB |
#include <iostream> #include <vector> #include <deque> #include <math.h> #include <set> #include <iomanip> #include <time.h> #include <list> #include <stdio.h> #include <queue> #include <map> #include <algorithm> #include <assert.h> #include <memory.h> #define mk make_pair #define sc second #define fr first #define pb emplace_back #define all(s) s.begin(), s.end() #define sz(s) ( (int)s.size() ) using namespace std; const int N = 275; bool dp[N][N * N]; int n, ar[N], mx = 270 * 270, sum; vector <int> ans; main () { cin >> n; for (int i = 1; i <= n; i++) scanf("%d", &ar[i]), sum += ar[i]; mx = sum; for (int i = 0; i <= n; i++) { dp[i][0] = 1; for (int j = 1; j <= n; j++) { if (i == j) continue; for (int k = mx - ar[j]; k >= 0; k--) dp[i][k + ar[j]] |= dp[i][k]; } } if ( sum & 1 || !dp[0][sum / 2] ) { puts("0"); return 0; } for (int i = 0; i <= mx; i++) { bool fl = true; for (int j = 1; j <= n; j++) { if ( ( (sum - ar[j] + i) & 1 ) || !dp[j][ (sum - ar[j] + i) / 2 - i ] ) { fl = false; break; } } if (fl) ans.pb(i); } cout << sz(ans) << endl; for (auto x : ans) printf("%d ", x); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 22324 KB | Output is correct |
2 | Correct | 0 ms | 22324 KB | Output is correct |
3 | Correct | 0 ms | 22324 KB | Output is correct |
4 | Correct | 0 ms | 22324 KB | Output is correct |
5 | Correct | 0 ms | 22324 KB | Output is correct |
6 | Correct | 0 ms | 22324 KB | Output is correct |
7 | Correct | 0 ms | 22324 KB | Output is correct |
8 | Correct | 0 ms | 22324 KB | Output is correct |
9 | Correct | 0 ms | 22324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 22324 KB | Output is correct |
2 | Correct | 0 ms | 22324 KB | Output is correct |
3 | Correct | 0 ms | 22324 KB | Output is correct |
4 | Correct | 0 ms | 22324 KB | Output is correct |
5 | Correct | 0 ms | 22324 KB | Output is correct |
6 | Correct | 0 ms | 22324 KB | Output is correct |
7 | Correct | 0 ms | 22324 KB | Output is correct |
8 | Correct | 0 ms | 22324 KB | Output is correct |
9 | Correct | 0 ms | 22324 KB | Output is correct |
10 | Correct | 0 ms | 22324 KB | Output is correct |
11 | Correct | 0 ms | 22324 KB | Output is correct |
12 | Correct | 0 ms | 22324 KB | Output is correct |
13 | Correct | 0 ms | 22324 KB | Output is correct |
14 | Correct | 0 ms | 22324 KB | Output is correct |
15 | Correct | 0 ms | 22324 KB | Output is correct |
16 | Correct | 0 ms | 22324 KB | Output is correct |
17 | Correct | 0 ms | 22324 KB | Output is correct |
18 | Correct | 0 ms | 22324 KB | Output is correct |
19 | Correct | 0 ms | 22324 KB | Output is correct |
20 | Correct | 0 ms | 22324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 22324 KB | Output is correct |
2 | Correct | 0 ms | 22324 KB | Output is correct |
3 | Correct | 0 ms | 22324 KB | Output is correct |
4 | Correct | 0 ms | 22324 KB | Output is correct |
5 | Correct | 0 ms | 22324 KB | Output is correct |
6 | Correct | 0 ms | 22324 KB | Output is correct |
7 | Correct | 0 ms | 22324 KB | Output is correct |
8 | Correct | 0 ms | 22324 KB | Output is correct |
9 | Correct | 0 ms | 22324 KB | Output is correct |
10 | Correct | 0 ms | 22324 KB | Output is correct |
11 | Correct | 0 ms | 22324 KB | Output is correct |
12 | Correct | 0 ms | 22324 KB | Output is correct |
13 | Correct | 0 ms | 22324 KB | Output is correct |
14 | Correct | 0 ms | 22324 KB | Output is correct |
15 | Correct | 0 ms | 22324 KB | Output is correct |
16 | Correct | 0 ms | 22324 KB | Output is correct |
17 | Correct | 0 ms | 22324 KB | Output is correct |
18 | Correct | 0 ms | 22324 KB | Output is correct |
19 | Correct | 0 ms | 22324 KB | Output is correct |
20 | Correct | 0 ms | 22324 KB | Output is correct |
21 | Correct | 16 ms | 22324 KB | Output is correct |
22 | Correct | 23 ms | 22324 KB | Output is correct |
23 | Correct | 6 ms | 22324 KB | Output is correct |
24 | Correct | 49 ms | 22324 KB | Output is correct |
25 | Correct | 109 ms | 22324 KB | Output is correct |
26 | Correct | 116 ms | 22324 KB | Output is correct |
27 | Correct | 119 ms | 22324 KB | Output is correct |
28 | Correct | 119 ms | 22324 KB | Output is correct |
29 | Correct | 116 ms | 22324 KB | Output is correct |
30 | Correct | 63 ms | 22324 KB | Output is correct |
31 | Correct | 99 ms | 22324 KB | Output is correct |
32 | Correct | 69 ms | 22324 KB | Output is correct |
33 | Correct | 119 ms | 22324 KB | Output is correct |
34 | Correct | 133 ms | 22324 KB | Output is correct |
35 | Correct | 129 ms | 22324 KB | Output is correct |
36 | Correct | 59 ms | 22324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 22324 KB | Output is correct |
2 | Correct | 0 ms | 22324 KB | Output is correct |
3 | Correct | 0 ms | 22324 KB | Output is correct |
4 | Correct | 0 ms | 22324 KB | Output is correct |
5 | Correct | 0 ms | 22324 KB | Output is correct |
6 | Correct | 0 ms | 22324 KB | Output is correct |
7 | Correct | 0 ms | 22324 KB | Output is correct |
8 | Correct | 0 ms | 22324 KB | Output is correct |
9 | Correct | 0 ms | 22324 KB | Output is correct |
10 | Correct | 0 ms | 22324 KB | Output is correct |
11 | Correct | 0 ms | 22324 KB | Output is correct |
12 | Correct | 0 ms | 22324 KB | Output is correct |
13 | Correct | 0 ms | 22324 KB | Output is correct |
14 | Correct | 0 ms | 22324 KB | Output is correct |
15 | Correct | 0 ms | 22324 KB | Output is correct |
16 | Correct | 0 ms | 22324 KB | Output is correct |
17 | Correct | 0 ms | 22324 KB | Output is correct |
18 | Correct | 0 ms | 22324 KB | Output is correct |
19 | Correct | 0 ms | 22324 KB | Output is correct |
20 | Correct | 0 ms | 22324 KB | Output is correct |
21 | Correct | 16 ms | 22324 KB | Output is correct |
22 | Correct | 23 ms | 22324 KB | Output is correct |
23 | Correct | 6 ms | 22324 KB | Output is correct |
24 | Correct | 49 ms | 22324 KB | Output is correct |
25 | Correct | 109 ms | 22324 KB | Output is correct |
26 | Correct | 116 ms | 22324 KB | Output is correct |
27 | Correct | 119 ms | 22324 KB | Output is correct |
28 | Correct | 119 ms | 22324 KB | Output is correct |
29 | Correct | 116 ms | 22324 KB | Output is correct |
30 | Correct | 63 ms | 22324 KB | Output is correct |
31 | Correct | 99 ms | 22324 KB | Output is correct |
32 | Correct | 69 ms | 22324 KB | Output is correct |
33 | Correct | 119 ms | 22324 KB | Output is correct |
34 | Correct | 133 ms | 22324 KB | Output is correct |
35 | Correct | 129 ms | 22324 KB | Output is correct |
36 | Correct | 59 ms | 22324 KB | Output is correct |
37 | Correct | 999 ms | 22464 KB | Output is correct |
38 | Execution timed out | 1000 ms | 22464 KB | Execution timed out |
39 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 22324 KB | Output is correct |
2 | Correct | 0 ms | 22324 KB | Output is correct |
3 | Correct | 0 ms | 22324 KB | Output is correct |
4 | Correct | 0 ms | 22324 KB | Output is correct |
5 | Correct | 0 ms | 22324 KB | Output is correct |
6 | Correct | 0 ms | 22324 KB | Output is correct |
7 | Correct | 0 ms | 22324 KB | Output is correct |
8 | Correct | 0 ms | 22324 KB | Output is correct |
9 | Correct | 0 ms | 22324 KB | Output is correct |
10 | Correct | 0 ms | 22324 KB | Output is correct |
11 | Correct | 0 ms | 22324 KB | Output is correct |
12 | Correct | 0 ms | 22324 KB | Output is correct |
13 | Correct | 0 ms | 22324 KB | Output is correct |
14 | Correct | 0 ms | 22324 KB | Output is correct |
15 | Correct | 0 ms | 22324 KB | Output is correct |
16 | Correct | 0 ms | 22324 KB | Output is correct |
17 | Correct | 0 ms | 22324 KB | Output is correct |
18 | Correct | 0 ms | 22324 KB | Output is correct |
19 | Correct | 0 ms | 22324 KB | Output is correct |
20 | Correct | 0 ms | 22324 KB | Output is correct |
21 | Correct | 16 ms | 22324 KB | Output is correct |
22 | Correct | 23 ms | 22324 KB | Output is correct |
23 | Correct | 6 ms | 22324 KB | Output is correct |
24 | Correct | 49 ms | 22324 KB | Output is correct |
25 | Correct | 109 ms | 22324 KB | Output is correct |
26 | Correct | 116 ms | 22324 KB | Output is correct |
27 | Correct | 119 ms | 22324 KB | Output is correct |
28 | Correct | 119 ms | 22324 KB | Output is correct |
29 | Correct | 116 ms | 22324 KB | Output is correct |
30 | Correct | 63 ms | 22324 KB | Output is correct |
31 | Correct | 99 ms | 22324 KB | Output is correct |
32 | Correct | 69 ms | 22324 KB | Output is correct |
33 | Correct | 119 ms | 22324 KB | Output is correct |
34 | Correct | 133 ms | 22324 KB | Output is correct |
35 | Correct | 129 ms | 22324 KB | Output is correct |
36 | Correct | 59 ms | 22324 KB | Output is correct |
37 | Correct | 999 ms | 22464 KB | Output is correct |
38 | Execution timed out | 1000 ms | 22464 KB | Execution timed out |
39 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 22324 KB | Output is correct |
2 | Correct | 0 ms | 22324 KB | Output is correct |
3 | Correct | 0 ms | 22324 KB | Output is correct |
4 | Correct | 0 ms | 22324 KB | Output is correct |
5 | Correct | 0 ms | 22324 KB | Output is correct |
6 | Correct | 0 ms | 22324 KB | Output is correct |
7 | Correct | 0 ms | 22324 KB | Output is correct |
8 | Correct | 0 ms | 22324 KB | Output is correct |
9 | Correct | 0 ms | 22324 KB | Output is correct |
10 | Correct | 0 ms | 22324 KB | Output is correct |
11 | Correct | 0 ms | 22324 KB | Output is correct |
12 | Correct | 0 ms | 22324 KB | Output is correct |
13 | Correct | 0 ms | 22324 KB | Output is correct |
14 | Correct | 0 ms | 22324 KB | Output is correct |
15 | Correct | 0 ms | 22324 KB | Output is correct |
16 | Correct | 0 ms | 22324 KB | Output is correct |
17 | Correct | 0 ms | 22324 KB | Output is correct |
18 | Correct | 0 ms | 22324 KB | Output is correct |
19 | Correct | 0 ms | 22324 KB | Output is correct |
20 | Correct | 0 ms | 22324 KB | Output is correct |
21 | Correct | 16 ms | 22324 KB | Output is correct |
22 | Correct | 23 ms | 22324 KB | Output is correct |
23 | Correct | 6 ms | 22324 KB | Output is correct |
24 | Correct | 49 ms | 22324 KB | Output is correct |
25 | Correct | 109 ms | 22324 KB | Output is correct |
26 | Correct | 116 ms | 22324 KB | Output is correct |
27 | Correct | 119 ms | 22324 KB | Output is correct |
28 | Correct | 119 ms | 22324 KB | Output is correct |
29 | Correct | 116 ms | 22324 KB | Output is correct |
30 | Correct | 63 ms | 22324 KB | Output is correct |
31 | Correct | 99 ms | 22324 KB | Output is correct |
32 | Correct | 69 ms | 22324 KB | Output is correct |
33 | Correct | 119 ms | 22324 KB | Output is correct |
34 | Correct | 133 ms | 22324 KB | Output is correct |
35 | Correct | 129 ms | 22324 KB | Output is correct |
36 | Correct | 59 ms | 22324 KB | Output is correct |
37 | Correct | 999 ms | 22464 KB | Output is correct |
38 | Execution timed out | 1000 ms | 22464 KB | Execution timed out |
39 | Halted | 0 ms | 0 KB | - |