# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97751 | 2019-02-18T10:13:43 Z | KLPP | Binary Subsequences (info1cup17_binary) | C++14 | 29 ms | 840 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int lld; vector<int> ANSWER[2000]; int main(){ /*int T; cin>>T; while(T--){ int K; cin>>K; cout<<-1<<endl;*/ /*for(int msk=0;msk<(1<<K);msk++){ int arr[K]; for(int i=0;i<K;i++)arr[i]=((msk&(1<<i))>0); lld DP[K]; lld ans=0; for(int i=0;i<K;i++){ DP[i]=0; bool b=true; for(int j=i-1;j>-1;j--){ DP[i]+=DP[j]; if(arr[j]==arr[i]){b=false; break; } }DP[i]+=b; ans+=DP[i]; //cout<<DP[i]<<endl; }cout<<ans<<" "; for(int i=0;i<K;i++)cout<<arr[i]; cout<<endl; }*/ //} for(int K=1;K<=16;K++){ for(int msk=0;msk<(1<<K);msk++){ int arr[K]; for(int i=0;i<K;i++)arr[i]=((msk&(1<<i))>0); lld DP[K]; lld ans=0; for(int i=0;i<K;i++){ DP[i]=0; bool b=true; for(int j=i-1;j>-1;j--){ DP[i]+=DP[j]; if(arr[j]==arr[i]){b=false; break; } }DP[i]+=b; ans+=DP[i]; //cout<<DP[i]<<endl; }//cout<<ans<<" "; if(ans<=2000 && ANSWER[ans-1].size()==0){ for(int i=0;i<K;i++)ANSWER[ans-1].push_back(arr[i]); } /*for(int i=0;i<K;i++)cout<<arr[i]; cout<<endl;*/ } } /*cout<<"#include<bits/stdc++.h>"<<endl; cout<<"using namespace std;"<<endl; cout<<"void answer(int K){"<<endl; for(int i=0;i<2000;i++){ cout<<"if(K=="<<i+1<<"){"<<endl; cout<<"cout<< "; for(int j=0;j<ANSWER[i].size();j++)cout<<ANSWER[i][j]<<" << ' ' <<"; cout<<"endl;"; cout<<endl; cout<<"}"<<endl; } cout<<"}"<<endl; cout<<"int main(){"<<endl; cout<<" int T;"<<endl; cout<<" cin>>T;"<<endl; cout<<" while(T--){"<<endl; cout<<" int K;"<<endl; cout<<" cin>>K;"<<endl; cout<<" cout<<-1<<endl;"<<endl; cout<<" answer(K);"<<endl; cout<<" }"<<endl; cout<<" }"<<endl; cout<<"}"<<endl;*/ int T; cin>>T; while(T--){ int K; cin>>K; cout<<-1<<endl; for(int i=0;i<ANSWER[K-1].size();i++)cout<<ANSWER[K-1][i]<<" "; cout<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 29 ms | 512 KB | Output is partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 21 ms | 768 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 | 25 ms | 840 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |