# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472791 | 2021-09-14T10:39:10 Z | ogibogi2004 | Bootfall (IZhO17_bootfall) | C++14 | 11 ms | 588 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN=512; int n,a[MAXN],sum=0; bitset<2*MAXN*MAXN>b1,b2,b3,b4; int main() { cin>>n; for(int i=1;i<=n;i++){cin>>a[i];sum+=a[i];} for(int i=0;i<MAXN*MAXN;i++)b1[i]=1; b1=0; b1[MAXN*MAXN]=1; for(int i=1;i<=n;i++) { b2=0; for(int j=0;j<2*MAXN*MAXN;j++) { if(b1[j]==0)continue; b2[j-a[i]]=1; b2[j+a[i]]=1; } b1=b2; } if(b1[MAXN*MAXN]==0) { cout<<"0\n"; return 0; } b2=0; for(int i=0;i<2*MAXN*MAXN;i++) { if(b1[i]==0)continue; b2[abs(MAXN*MAXN-i)]=1; } b1=b2; for(int i=0;i<MAXN*MAXN;i++) { if(b1[i])cout<<i<<" "; } cout<<endl; cout<<endl; for(int i=0;i<MAXN*MAXN;i++)b3[i]=1; for(int i=1;i<=n;i++) { b4=0; for(int j=0;j<MAXN*MAXN;j++) { if(b1[j]==0)continue; int t=abs(j-a[i]); b4[t]=1; } for(int j=0;j<MAXN*MAXN;j++) { if(b4[j])cout<<j<<" "; } cout<<endl; b3&=b4; for(int j=0;j<MAXN*MAXN;j++) { if(b3[j])cout<<j<<" "; } cout<<endl; cout<<endl<<endl; } vector<int>ans; for(int i=1;i<=sum;i++) { if(b3[i]==1)ans.push_back(i); } cout<<ans.size()<<endl; for(auto xd:ans) { cout<<xd<<" "; } cout<<endl; if(ans.size()>n)assert(false); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |