import java.util.*; import java.io.*;
public class lyuboyn {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
}
public static void main(String[] args) {
FastReader br=new FastReader();
int N=br.nextInt(); int K=br.nextInt(); int T=br.nextInt();
if((K&1)==0){
System.out.println("-1");return;
}
int[] cur=new int[1<<(K+1)];//Start with (K,K+1)
for (int i = 1; i < 1<<(K+1); i++) {
int j=0; while((i&(1<<j))==0){j++;}
cur[i]=((1<<(K+1))-1-cur[i-1])^(1<<j);
}
//System.out.println(Arrays.toString(cur));
for(int B=K+2; B<=N; B++){
int[] nxt=new int[1<<B];
nxt[1]=(1<<(B-1))+(1<<(K-1))-1;
for(int j=2; j<=(1<<(B-1)); j++){
nxt[j]=nxt[1]^cur[j-1];
}
for(int j=(1<<(B-1))+1; j<(1<<B); j++){
nxt[j]=cur[(1<<B)-j];
}
cur=new int[1<<B]; for(int i=0;i<(1<<B); i++) {cur[i]=nxt[i];}
}
//System.out.println(Arrays.toString(cur));
int st=Integer.parseInt(br.next(),2);
System.out.println(1<<N);
StringBuilder sb=new StringBuilder();
for (int i = 0; i < (1<<N); i++) {
sb.append(Integer.toString((1<<N)+(st^cur[i]),2).substring(1)+"\n");
}
System.out.println(sb.toString());
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
9960 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
109 ms |
9708 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
8556 KB |
Ok |
2 |
Correct |
72 ms |
8428 KB |
Ok |
3 |
Correct |
70 ms |
8556 KB |
Ok |
4 |
Correct |
75 ms |
8540 KB |
Ok |
5 |
Correct |
70 ms |
8556 KB |
Ok |
6 |
Correct |
70 ms |
8556 KB |
Ok |
7 |
Correct |
71 ms |
8556 KB |
Ok |
8 |
Correct |
72 ms |
8556 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
448 ms |
41524 KB |
Ok |
2 |
Correct |
378 ms |
24308 KB |
Ok |
3 |
Correct |
156 ms |
11320 KB |
Ok |
4 |
Correct |
110 ms |
9532 KB |
Ok |
5 |
Correct |
111 ms |
9580 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
116 ms |
9692 KB |
Ok |
2 |
Correct |
290 ms |
13824 KB |
Ok |
3 |
Correct |
382 ms |
24268 KB |
Ok |
4 |
Correct |
350 ms |
17396 KB |
Ok |
5 |
Correct |
117 ms |
9892 KB |
Ok |
6 |
Correct |
190 ms |
11756 KB |
Ok |
7 |
Correct |
338 ms |
15364 KB |
Ok |
8 |
Correct |
116 ms |
9836 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
439 ms |
41500 KB |
Ok |
2 |
Correct |
446 ms |
41460 KB |
Ok |
3 |
Correct |
443 ms |
41496 KB |
Ok |
4 |
Correct |
385 ms |
24436 KB |
Ok |
5 |
Correct |
386 ms |
24264 KB |
Ok |
6 |
Correct |
351 ms |
17552 KB |
Ok |
7 |
Correct |
364 ms |
17504 KB |
Ok |
8 |
Correct |
344 ms |
15476 KB |
Ok |
9 |
Correct |
343 ms |
15604 KB |
Ok |
10 |
Correct |
335 ms |
14504 KB |
Ok |
11 |
Correct |
152 ms |
11560 KB |
Ok |
12 |
Correct |
158 ms |
11344 KB |
Ok |
13 |
Correct |
117 ms |
9696 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
448 ms |
41524 KB |
Ok |
2 |
Correct |
378 ms |
24308 KB |
Ok |
3 |
Correct |
156 ms |
11320 KB |
Ok |
4 |
Correct |
110 ms |
9532 KB |
Ok |
5 |
Correct |
111 ms |
9580 KB |
Ok |
6 |
Correct |
116 ms |
9692 KB |
Ok |
7 |
Correct |
290 ms |
13824 KB |
Ok |
8 |
Correct |
382 ms |
24268 KB |
Ok |
9 |
Correct |
350 ms |
17396 KB |
Ok |
10 |
Correct |
117 ms |
9892 KB |
Ok |
11 |
Correct |
190 ms |
11756 KB |
Ok |
12 |
Correct |
338 ms |
15364 KB |
Ok |
13 |
Correct |
116 ms |
9836 KB |
Ok |
14 |
Correct |
439 ms |
41500 KB |
Ok |
15 |
Correct |
446 ms |
41460 KB |
Ok |
16 |
Correct |
443 ms |
41496 KB |
Ok |
17 |
Correct |
385 ms |
24436 KB |
Ok |
18 |
Correct |
386 ms |
24264 KB |
Ok |
19 |
Correct |
351 ms |
17552 KB |
Ok |
20 |
Correct |
364 ms |
17504 KB |
Ok |
21 |
Correct |
344 ms |
15476 KB |
Ok |
22 |
Correct |
343 ms |
15604 KB |
Ok |
23 |
Correct |
335 ms |
14504 KB |
Ok |
24 |
Correct |
152 ms |
11560 KB |
Ok |
25 |
Correct |
158 ms |
11344 KB |
Ok |
26 |
Correct |
117 ms |
9696 KB |
Ok |
27 |
Correct |
412 ms |
38940 KB |
Ok |
28 |
Correct |
401 ms |
23480 KB |
Ok |
29 |
Correct |
442 ms |
41036 KB |
Ok |
30 |
Correct |
335 ms |
14600 KB |
Ok |
31 |
Correct |
151 ms |
11304 KB |
Ok |
32 |
Correct |
247 ms |
13272 KB |
Ok |
33 |
Correct |
333 ms |
15144 KB |
Ok |
34 |
Correct |
114 ms |
9708 KB |
Ok |
35 |
Correct |
114 ms |
9580 KB |
Ok |
36 |
Correct |
117 ms |
9708 KB |
Ok |
37 |
Correct |
111 ms |
9600 KB |
Ok |
38 |
Correct |
384 ms |
23704 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
384 ms |
23452 KB |
Ok |
2 |
Correct |
421 ms |
39068 KB |
Ok |
3 |
Correct |
446 ms |
41128 KB |
Ok |
4 |
Correct |
336 ms |
14436 KB |
Ok |
5 |
Correct |
122 ms |
10140 KB |
Ok |
6 |
Correct |
334 ms |
15048 KB |
Ok |
7 |
Correct |
441 ms |
41416 KB |
Ok |
8 |
Correct |
152 ms |
11432 KB |
Ok |
9 |
Correct |
111 ms |
9580 KB |
Ok |
10 |
Correct |
164 ms |
11524 KB |
Ok |
11 |
Correct |
333 ms |
17032 KB |
Ok |
12 |
Correct |
404 ms |
23548 KB |
Ok |