#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");
}
int cnt = 1<<n;
cnt-=2;
if(k==1){
v[0]=1;
v[(1<<n)-1]=1;
ans1.pb(0);
ans2.pb((1<<n)-1);
while(cnt>0){cnt-=2;for(int i=0;i<1<<n;i++){
for(int j=0;j<n;j++){
if(!v[s^(1<<j)]){
v[s^(1<<j)]=1;
v[((1<<n)-1)^((s^(1<<j)))]=1;
ans1.pb(s^(1<<j));
ans2.pb(((1<<n)-1)^((s^(1<<j))));
s = ((s^(1<<j)));
}
}
}
}
while(s>0){
if(s%2==1)break;
s>>=1;
}
if(cnt!=0||s!=1){
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");
}
for(auto i:ans2){
for(int j=0;j<n;j++){
printf("%d",(i>>j)&1);
}
printf("\n");
}
}
}
else printf("-1");
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output -1 while solution exists |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
More lines are printed! |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Ok |
2 |
Correct |
0 ms |
256 KB |
Ok |
3 |
Correct |
0 ms |
256 KB |
Ok |
4 |
Correct |
0 ms |
256 KB |
Ok |
5 |
Correct |
0 ms |
256 KB |
Ok |
6 |
Correct |
0 ms |
384 KB |
Ok |
7 |
Correct |
0 ms |
256 KB |
Ok |
8 |
Correct |
0 ms |
256 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
2300 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
2300 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |