# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344248 | 2021-01-05T10:19:03 Z | Enkhmunkh | Bootfall (IZhO17_bootfall) | C++14 | 1000 ms | 492 KB |
#include <bits/stdc++.h> #define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; bool check(int sum, vector<int>v, int n) { if(sum % 2) { return 0; } sum /= 2; vector<bool> dp(sum + 1, 0); dp[0] = 1; for(int i = 0; i < n; i++) { for(int j = sum; j >= v[i]; j--) { if(dp[j - v[i]]) dp[j] = 1; } } if (dp[sum]) { return 1; }else { return 0; } } int main () { FAST; int n; cin >> n; vector<int> arr; int sum = 0; int tmp; for (int i = 0; i < n; i++) { cin >> tmp; arr.push_back(tmp); sum+=tmp; } vector<int> val; for (int i = 1; i <= sum; i++) { vector<int> cp(arr); sum+=i; cp.push_back(i); int b = 0; for (int j = 0; j < n+1; j++) { int tmp = cp[j]; sum-=tmp; cp.erase(cp.begin()+j); if (check(sum, cp, n)) { b++; } cp.insert(cp.begin() + j, tmp); sum+=tmp; } if (b == n+1) { val.push_back(i); } cp.pop_back(); sum-=i; } cout << val.size() << "\n"; for (int i = 0; i < val.size(); i++) { cout << val[i] << " "; } cout << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 78 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 492 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 193 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 78 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 492 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 193 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 125 ms | 364 KB | Output is correct |
11 | Correct | 45 ms | 364 KB | Output is correct |
12 | Correct | 66 ms | 492 KB | Output is correct |
13 | Correct | 34 ms | 388 KB | Output is correct |
14 | Correct | 57 ms | 364 KB | Output is correct |
15 | Correct | 27 ms | 364 KB | Output is correct |
16 | Correct | 41 ms | 492 KB | Output is correct |
17 | Correct | 9 ms | 364 KB | Output is correct |
18 | Correct | 26 ms | 364 KB | Output is correct |
19 | Correct | 22 ms | 364 KB | Output is correct |
20 | Correct | 162 ms | 388 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 78 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 492 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 193 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 125 ms | 364 KB | Output is correct |
11 | Correct | 45 ms | 364 KB | Output is correct |
12 | Correct | 66 ms | 492 KB | Output is correct |
13 | Correct | 34 ms | 388 KB | Output is correct |
14 | Correct | 57 ms | 364 KB | Output is correct |
15 | Correct | 27 ms | 364 KB | Output is correct |
16 | Correct | 41 ms | 492 KB | Output is correct |
17 | Correct | 9 ms | 364 KB | Output is correct |
18 | Correct | 26 ms | 364 KB | Output is correct |
19 | Correct | 22 ms | 364 KB | Output is correct |
20 | Correct | 162 ms | 388 KB | Output is correct |
21 | Execution timed out | 1050 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 78 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 492 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 193 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 125 ms | 364 KB | Output is correct |
11 | Correct | 45 ms | 364 KB | Output is correct |
12 | Correct | 66 ms | 492 KB | Output is correct |
13 | Correct | 34 ms | 388 KB | Output is correct |
14 | Correct | 57 ms | 364 KB | Output is correct |
15 | Correct | 27 ms | 364 KB | Output is correct |
16 | Correct | 41 ms | 492 KB | Output is correct |
17 | Correct | 9 ms | 364 KB | Output is correct |
18 | Correct | 26 ms | 364 KB | Output is correct |
19 | Correct | 22 ms | 364 KB | Output is correct |
20 | Correct | 162 ms | 388 KB | Output is correct |
21 | Execution timed out | 1050 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 78 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 492 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 193 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 125 ms | 364 KB | Output is correct |
11 | Correct | 45 ms | 364 KB | Output is correct |
12 | Correct | 66 ms | 492 KB | Output is correct |
13 | Correct | 34 ms | 388 KB | Output is correct |
14 | Correct | 57 ms | 364 KB | Output is correct |
15 | Correct | 27 ms | 364 KB | Output is correct |
16 | Correct | 41 ms | 492 KB | Output is correct |
17 | Correct | 9 ms | 364 KB | Output is correct |
18 | Correct | 26 ms | 364 KB | Output is correct |
19 | Correct | 22 ms | 364 KB | Output is correct |
20 | Correct | 162 ms | 388 KB | Output is correct |
21 | Execution timed out | 1050 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 78 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 492 KB | Output is correct |
7 | Correct | 2 ms | 364 KB | Output is correct |
8 | Correct | 193 ms | 364 KB | Output is correct |
9 | Correct | 20 ms | 364 KB | Output is correct |
10 | Correct | 125 ms | 364 KB | Output is correct |
11 | Correct | 45 ms | 364 KB | Output is correct |
12 | Correct | 66 ms | 492 KB | Output is correct |
13 | Correct | 34 ms | 388 KB | Output is correct |
14 | Correct | 57 ms | 364 KB | Output is correct |
15 | Correct | 27 ms | 364 KB | Output is correct |
16 | Correct | 41 ms | 492 KB | Output is correct |
17 | Correct | 9 ms | 364 KB | Output is correct |
18 | Correct | 26 ms | 364 KB | Output is correct |
19 | Correct | 22 ms | 364 KB | Output is correct |
20 | Correct | 162 ms | 388 KB | Output is correct |
21 | Execution timed out | 1050 ms | 492 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |