# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77116 | 2018-09-22T13:28:42 Z | zetapi | Bootfall (IZhO17_bootfall) | C++14 | 13 ms | 5240 KB |
#include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define int long long #define itr iterator typedef pair<ll,ll> pii; const ll MAX=3e5+9; const ll LIM=3e5; const ll mod=1e9+7; bitset<500*500+9> bs; ll N,sum,arr[500*500+9],dp[500*500+9]; void TakeMod(ll &X,ll Y) { while(X<0) X+=Y; while(X>=Y) X-=Y; return ; } void add(ll X) { sum+=X; for(int A=500*500;A>=X;A--) { dp[A]+=dp[A-X]; TakeMod(dp[A],mod); } return ; } void remove(ll X) { sum-=X; for(int A=500*500;A<LIM;A++) { dp[A]-=dp[A-X]; TakeMod(dp[A],mod); } return ; } signed main() { ios_base::sync_with_stdio(false); dp[0]=1; cin>>N; for(int A=1;A<=N;A++) { cin>>arr[A]; add(arr[A]); } if(sum%2 or (!dp[sum/2])) return cout<<0,0; for(int A=1;A<=500*500;A++) bs[A]=1; for(int A=1;A<=N;A++) { remove(arr[A]); for(int B=1;B<=500*500;B++) if(B>sum or (sum+B)%2 or (!dp[(sum+B)/2])) bs[B]=0; add(arr[A]); } vector<int> vec; for(int A=1;A<=sum;A++) if(bs[A]) vec.pb(A); cout<<vec.size()<<"\n"; for(auto A:vec) cout<<A<<" "; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 5240 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 5240 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 5240 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 5240 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 5240 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 5240 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |