This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 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)));
}
}
}
//printf("d");
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");
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |