# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370436 | 2021-02-24T02:59:56 Z | daniel920712 | "The Lyuboyn" code (IZhO19_lyuboyn) | C++14 | 243 ms | 6932 KB |
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <vector> #include <stack> using namespace std; stack < int > t; vector < int > all; char tt[100005]; int N,K,T,S; int ans[1000005][25]; void F(int here) { int i,j; if(here==0) { all.push_back(0); all.push_back(1); } else if(here==N) { printf("%d\n",1<<N); for(auto i:all) { for(j=N-1;j>=0;j--) { if(i&(1<<j)) printf("1"); else printf("0"); } printf("\n"); } return; } else { for(auto i:all) t.push(i+(1<<here)); while(!t.empty()) { all.push_back(t.top()); t.pop(); } } F(here+1); } void F2(int here) { int i,j,now=0; if(here==0) { all.push_back(0); all.push_back(1); } else if(here==N) { for(auto i:all) { for(j=N-1;j>=0;j--) { if(i&(1<<j)) ans[now][N-j-1]=1; else ans[now][N-j-1]=0; if(now==0) { if(i&(1<<j)) ans[1<<N][N-j-1]=1; else ans[1<<N][N-j-1]=0; } } now++; } return; } else { for(auto i:all) t.push(i+(1<<here)); while(!t.empty()) { all.push_back(t.top()); t.pop(); } } F2(here+1); } int main() { int i,j,k; scanf("%d %d %d",&N,&K,&T); scanf("%s",tt); if(K%2==0||K>N||(K==N&&K!=1)) printf("-1\n"); else if(K==1) F(0); else if(K==3) { printf("%d\n",1<<N); F2(0); for(i=1;i<(1<<N);i+=2) { for(j=1;j<=4;j++) { if(ans[i][N-j]==ans[i-1][N-j]&&ans[i][N-j]==ans[i+1][N-j]) ans[i][N-j]=1-ans[i][N-j]; } } for(i=0;i<(1<<N);i++) { for(j=0;j<N;j++) printf("%d",ans[i][j]); printf("\n"); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | First number in answer is not x 1 0 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Ok |
2 | Correct | 0 ms | 364 KB | Ok |
3 | Correct | 1 ms | 364 KB | Ok |
4 | Correct | 1 ms | 364 KB | Ok |
5 | Correct | 1 ms | 364 KB | Ok |
6 | Correct | 1 ms | 364 KB | Ok |
7 | Correct | 1 ms | 364 KB | Ok |
8 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 243 ms | 6932 KB | Ok |
2 | Correct | 120 ms | 3428 KB | Ok |
3 | Correct | 1 ms | 364 KB | Ok |
4 | Correct | 0 ms | 364 KB | Ok |
5 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | The values in the output sequence are not pairwise distinct! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 364 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 243 ms | 6932 KB | Ok |
2 | Correct | 120 ms | 3428 KB | Ok |
3 | Correct | 1 ms | 364 KB | Ok |
4 | Correct | 0 ms | 364 KB | Ok |
5 | Correct | 1 ms | 364 KB | Ok |
6 | Incorrect | 1 ms | 364 KB | The values in the output sequence are not pairwise distinct! |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 364 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |