# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
35266 | 2017-11-19T14:08:13 Z | dqhungdl | Bootfall (IZhO17_bootfall) | C++14 | 0 ms | 3008 KB |
#include <bits/stdc++.h> using namespace std; const int N=122501; int n,sum,a[505],C[250005]; bitset<N> f; vector<int> rs; bool Special() { if(sum%2==1) return false; f[0]=1; for(int i=1;i<=n;i++) f|=(f<<a[i]); return f[sum/2]; } void Check(int pos) { f.reset(); f[0]=1; for(int i=1;i<=n;i++) if(i!=pos) f|=(f<<a[i]); for(int i=0;i<(sum-a[pos]+1)/2;i++) if(f[i]==1) C[sum-a[pos]-2*i]++; } int main() { freopen("TEST.INP","r",stdin); cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; sum+=a[i]; } if(Special()==false) { cout<<0; return 0; } for(int i=1;i<=n;i++) Check(i); for(int i=1;i<=sum;i++) if(C[i]==n) rs.push_back(i); cout<<rs.size()<<"\n"; for(int i=0;i<rs.size();i++) cout<<rs[i]<<' '; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |