# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
681988 | 2023-01-15T06:27:46 Z | boykut | Bootfall (IZhO17_bootfall) | C++14 | 4 ms | 328 KB |
#include <bits/stdc++.h> using namespace std; const int MAXA = 20, MAXN = 30; int dp[MAXA*MAXA+1], cant[MAXA*MAXA+1]; int a[MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; dp[0] = 1; int sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; for (int x = MAXA*MAXA-a[i]; x >= 0; x--) { dp[x + a[i]] += dp[x]; } } if (sum % 2 == 1 || dp[sum / 2] == 0) { return cout << 0, 0; } vector<int> ans; for (int Tima = 0; Tima <= MAXA*MAXA; Tima++) { for (int Without = 0; Without < n; Without++) { memset(dp, 0, sizeof dp); dp[0] = dp[Tima] = 1; sum += Tima - a[Without]; for (int i = 0; i < n; i++) { if (i == Without) continue; for (int x = MAXA*MAXA-a[i]; x >= 0; x--) { dp[x + a[i]] += dp[x]; } } if (sum % 2 == 1 || dp[sum / 2] == 0) cant[Tima] = 1; sum -= Tima - a[Without]; } } for (int Tima = 0; Tima <= MAXA*MAXA; Tima++) { if (cant[Tima] == 0) ans.push_back(Tima); } cout << ans.size() << "\n"; for (int i = 0; i < ans.size(); i++) { cout << ans[i] << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 328 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |