#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
//#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define prc(n) fixed << setprecision(n)
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1);
const int inf = 1e9+7;
const int N = 105;
int n, k, t, a, cnt;
void bin(int a){
for(int i = n-1; i >=0 ;i--)
cout<< (a&(1<<i) ? 1 : 0);
cout<<"\n";
}
int main(){
fastios
cin>>n>>k>>t;
if(k%2 == 0){
cout<<-1;
return 0;
}
string s;
cin>>s;
reverse(all(s));
for(int i=0;i<sz(s);i++, cnt++)
if(s[i] == '1') a += (1<<i);
vector<int>ans = {0, 1};
int mx = (1<<(k+1)) - 1;
while(sz(ans) < (1<<(k+1))){
cnt++;
int add = sz(ans), size = sz(ans);
for(int i = size-1; i>=0; i--, cnt++) ans.pb(ans[i] + add);
}
for(int i=0;i<sz(ans);i++, cnt++) if(i % 2 == 0) ans[i] ^= mx;
mx = (1<<(k-1)) -1;
while(sz(ans) < (1<<n)){
cnt++;
int add = sz(ans), size = sz(ans);
for(int i = size-1; i>=0; i--, cnt++) ans.pb((ans[i] + add) ^ mx);
}
int start = 0;
for(int i=0;i<(1<<n);i++, cnt++) if(ans[i] == a) start = i;
cout<<(1<<n)<<"\n";
int size = (1<<n);
for(int i=start+1; i != start; i++){
if(i == size+1) i = 1;
bin(ans[i-1]);
}
bin(ans[start-1]);
//cout<<cnt<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
492 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
2 |
Correct |
1 ms |
364 KB |
Ok |
3 |
Correct |
0 ms |
364 KB |
Ok |
4 |
Correct |
1 ms |
364 KB |
Ok |
5 |
Correct |
0 ms |
364 KB |
Ok |
6 |
Correct |
1 ms |
384 KB |
Ok |
7 |
Correct |
1 ms |
364 KB |
Ok |
8 |
Correct |
1 ms |
364 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
273 ms |
6632 KB |
Ok |
2 |
Correct |
129 ms |
3436 KB |
Ok |
3 |
Correct |
1 ms |
364 KB |
Ok |
4 |
Correct |
1 ms |
364 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
2 |
Correct |
7 ms |
492 KB |
Ok |
3 |
Correct |
132 ms |
3308 KB |
Ok |
4 |
Correct |
65 ms |
1904 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
6 |
Correct |
2 ms |
364 KB |
Ok |
7 |
Correct |
29 ms |
1132 KB |
Ok |
8 |
Correct |
1 ms |
364 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
273 ms |
6504 KB |
Ok |
2 |
Correct |
273 ms |
6632 KB |
Ok |
3 |
Correct |
271 ms |
6504 KB |
Ok |
4 |
Correct |
130 ms |
3436 KB |
Ok |
5 |
Correct |
129 ms |
3308 KB |
Ok |
6 |
Correct |
61 ms |
1904 KB |
Ok |
7 |
Correct |
61 ms |
1856 KB |
Ok |
8 |
Correct |
29 ms |
1132 KB |
Ok |
9 |
Correct |
29 ms |
1132 KB |
Ok |
10 |
Correct |
14 ms |
748 KB |
Ok |
11 |
Correct |
1 ms |
364 KB |
Ok |
12 |
Correct |
1 ms |
364 KB |
Ok |
13 |
Correct |
1 ms |
364 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
273 ms |
6632 KB |
Ok |
2 |
Correct |
129 ms |
3436 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 |
7 ms |
492 KB |
Ok |
8 |
Correct |
132 ms |
3308 KB |
Ok |
9 |
Correct |
65 ms |
1904 KB |
Ok |
10 |
Correct |
1 ms |
364 KB |
Ok |
11 |
Correct |
2 ms |
364 KB |
Ok |
12 |
Correct |
29 ms |
1132 KB |
Ok |
13 |
Correct |
1 ms |
364 KB |
Ok |
14 |
Correct |
273 ms |
6504 KB |
Ok |
15 |
Correct |
273 ms |
6632 KB |
Ok |
16 |
Correct |
271 ms |
6504 KB |
Ok |
17 |
Correct |
130 ms |
3436 KB |
Ok |
18 |
Correct |
129 ms |
3308 KB |
Ok |
19 |
Correct |
61 ms |
1904 KB |
Ok |
20 |
Correct |
61 ms |
1856 KB |
Ok |
21 |
Correct |
29 ms |
1132 KB |
Ok |
22 |
Correct |
29 ms |
1132 KB |
Ok |
23 |
Correct |
14 ms |
748 KB |
Ok |
24 |
Correct |
1 ms |
364 KB |
Ok |
25 |
Correct |
1 ms |
364 KB |
Ok |
26 |
Correct |
1 ms |
364 KB |
Ok |
27 |
Correct |
272 ms |
6504 KB |
Ok |
28 |
Correct |
135 ms |
3436 KB |
Ok |
29 |
Correct |
270 ms |
6504 KB |
Ok |
30 |
Correct |
14 ms |
748 KB |
Ok |
31 |
Correct |
1 ms |
364 KB |
Ok |
32 |
Correct |
7 ms |
492 KB |
Ok |
33 |
Correct |
29 ms |
1132 KB |
Ok |
34 |
Correct |
1 ms |
364 KB |
Ok |
35 |
Correct |
1 ms |
364 KB |
Ok |
36 |
Correct |
1 ms |
364 KB |
Ok |
37 |
Execution timed out |
1081 ms |
22684 KB |
Time limit exceeded |
38 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
131 ms |
3428 KB |
Ok |
2 |
Correct |
276 ms |
6504 KB |
Ok |
3 |
Correct |
271 ms |
6504 KB |
Ok |
4 |
Correct |
14 ms |
748 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
6 |
Correct |
29 ms |
1132 KB |
Ok |
7 |
Correct |
270 ms |
6492 KB |
Ok |
8 |
Correct |
1 ms |
364 KB |
Ok |
9 |
Correct |
1 ms |
364 KB |
Ok |
10 |
Correct |
1 ms |
364 KB |
Ok |
11 |
Correct |
62 ms |
1904 KB |
Ok |
12 |
Correct |
130 ms |
3308 KB |
Ok |