//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
int n,k,t;
vector<vector<int>> solve(int n){
if(n==2){
return {{0,0},{0,1},{1,1},{1,0}};
}
else{
vector<vector<int>> aa=solve(n-1);
vector<vector<int>> bb=solve(n-1);
for(int i=0;i<aa.size();i++){
aa[i].pb(0);
bb[i].pb(1);
}
for(int i=0;i<bb.size();i++){
aa.pb(bb[i]);
}
return aa;
}
}
int it[20];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>k>>t;
string s;
cin>>s;
for(int i=0;i<n;i++){
it[i]=s[i]-'0';
}
if(k==1){
vector<vector<int>> ans=solve(n);
int ind=-1;
for(int i=0;i<ans.size();i++){
int st=1;
for(int j=0;j<n;j++){
if(ans[i][j]!=it[j]){
st=0;
}
}
if(st==1){
ind=i;
}
}
cout<<ans.size()<<endl;
for(int jj=ind;jj<ans.size();jj++){
for(auto i:ans[jj]){
cout<<i;
}
cout<<endl;
}
for(int jj=0;jj<ind;jj++){
for(auto i:ans[jj]){
cout<<i;
}
cout<<endl;
}
}
return 0;
}
Compilation message
lyuboyn.cpp: In function 'std::vector<std::vector<int> > solve(int)':
lyuboyn.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | for(int i=0;i<aa.size();i++){
| ~^~~~~~~~~~
lyuboyn.cpp:22:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int i=0;i<bb.size();i++){
| ~^~~~~~~~~~
lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:41:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(int i=0;i<ans.size();i++){
| ~^~~~~~~~~~~
lyuboyn.cpp:53:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int jj=ind;jj<ans.size();jj++){
| ~~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Unexpected end of file - int32 expected |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
934 ms |
59836 KB |
Fail, not exactly k bits are different: line = 3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
934 ms |
59836 KB |
Fail, not exactly k bits are different: line = 3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |