# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
457767 | 2021-08-07T11:30:03 Z | mariowong | Bootfall (IZhO17_bootfall) | C++14 | 1 ms | 204 KB |
#include <bits/stdc++.h> using namespace std; int ct[250005],n,a[505],sum; bool dp[250005],gg[250005]; vector <int> ans; int main() { ios::sync_with_stdio(false); cin >> n; for (int i=1;i<=n;i++){ cin >> a[i]; sum+=a[i]; } for (int i=0;i<=n;i++){ for (int j=1;j<=n*500;j++){ dp[j]=false; gg[j]=false; } dp[0]=true; for (int j=1;j<=n;j++){ if (j != i){ for (int k=j*500;k>=a[j];k--){ dp[k]=dp[k]|dp[k-a[j]]; } } } for (int j=0;j<=n*500;j++){ if (dp[j] && !gg[max(j,sum-j-a[i])-min(j,sum-j-a[i])]){ ct[max(j,sum-j-a[i])-min(j,sum-j-a[i])]++; gg[max(j,sum-j-a[i])-min(j,sum-j-a[i])]=true; } } } for (int i=1;i<=n*500;i++){ if (ct[i] == n+1) ans.push_back(i); } cout << (int)ans.size() << "\n"; for (int i=0;i<ans.size();i++){ cout << ans[i] << " "; } cout << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |