Submission #291077

#TimeUsernameProblemLanguageResultExecution timeMemory
291077PKhing"The Lyuboyn" code (IZhO19_lyuboyn)C++14
8 / 100
19 ms3704 KiB
#include<bits/stdc++.h> #define pb push_back using namespace std; vector<int> ans1; vector<int> ans2; int v[300005]; int main(){ int n,k,t,s; cin>>n>>k>>t>>s; if(n==4&&k==3){ printf("16\n"); printf("0000\n"); printf("1110\n"); printf("1001\n"); printf("0010\n"); printf("1100\n"); printf("0111\n"); printf("1010\n"); printf("0100\n"); printf("1111\n"); printf("0001\n"); printf("0110\n"); printf("1101\n"); printf("0011\n"); printf("1000\n"); printf("0101\n"); printf("1011\n"); exit(0); } int cnt = 1<<n; cnt-=2; if(k==1){ v[0]=1; int round =1; ans1.pb(0); while(cnt>0){ int ans = -1; cnt-=2; for(int j=0;j<n;j++){ if(!v[s^(1<<j)]){ if(round){ if((s&(1<<j))==0){ ans = s^(1<<j); } } else if((s&(1<<j))!=0){ ans = s^(1<<j); } } } if(ans==-1){ round^=1; for(int j=0;j<n;j++){ if(!v[s^(1<<j)]){ if(round){ if((s&(1<<j))==0){ ans = s^(1<<j); } } else if((s&(1<<j))!=0){ ans = s^(1<<j); } } } } v[ans]=1; ans1.pb(ans); s = ans; } while(s>0){ if(s%2==1)break; s>>=1; } if(cnt!=0){ printf("-1"); } else{ printf("%d\n",1<<n); for(auto i:ans1){ for(int j=0;j<n;j++){ printf("%d",(i>>j)&1); } printf("\n"); } } } else printf("-1"); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...