#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,k,t,fst;
vector<int> v;
string s;
int main(){
cin >> n >> k >> t;
cin >> s;
for(auto it:s){
fst = fst * 2 + it - '0';
}
if(k % 2 == 0){
printf("-1");
return 0;
}
int _n = 2;
int _k = 1;
v = {0,1,3,2};
while(_k < k){
vector<int> nv;
for(int i = 0;i < (1 << _n);i++){
nv.push_back(v[i] ^ ((i % 2 == 0 ? 0:3) << _n));
}
for(int i = 0;i < (1 << _n);i++){
nv.push_back(((1 << _n) - 1) ^ v[(1 << _n) - 1 - i] ^ ((i % 2 == 0 ? 2:1) << _n));
}
for(int i = 0;i < (1 << _n);i++){
nv.push_back(v[i] ^ ((i % 2 == 0 ? 3:0) << _n));
}
for(int i = 0;i < (1 << _n);i++){
nv.push_back(((1 << _n) - 1) ^ v[(1 << _n) - 1 - i] ^ ((i % 2 == 0 ? 1:2) << _n));
}
_k += 2;
_n += 2;
v = nv;
}
while(_n < n){
vector<int> nv;
for(int i = 0;i < (1 << _n);i++){
nv.push_back(v[i]);
}
for(int i = 0;i < (1 << _n);i++){
nv.push_back(v[i] ^ (1 << _n));
}
for(int h = 0;h < _n;h++){
if(((v[0] >> h) & 1) != ((v[(1 << _n) - 1] >> h) & 1)){
for(int i = (1 << _n);i < (2 << _n);i++){
nv[i] ^= (1 << h);
}
break;
}
}
_n++;
v = nv;
}
/*
for(int i = 0;i < (1 << n);i++){
printf("%d ",__builtin_popcount(v[i] ^ v[(i + 1) & ((1 << n) - 1)]));
}
printf("\n");
*/
for(int i = 0;i < (1 << n);i++){
v[i] ^= fst;
for(int h = 0;h < n;h++){
printf("%d",((v[i] >> h)) & 1);
}
printf("\n");
}
printf("\n");
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Expected integer, but "01" found |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Expected integer, but "0000" found |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Ok |
2 |
Correct |
0 ms |
364 KB |
Ok |
3 |
Correct |
0 ms |
364 KB |
Ok |
4 |
Correct |
1 ms |
268 KB |
Ok |
5 |
Correct |
0 ms |
364 KB |
Ok |
6 |
Correct |
0 ms |
364 KB |
Ok |
7 |
Correct |
0 ms |
364 KB |
Ok |
8 |
Correct |
0 ms |
364 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
490 ms |
6508 KB |
Expected integer, but "000000000000000000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Expected integer, but "0000000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
484 ms |
6680 KB |
Expected integer, but "001010110010101010" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
490 ms |
6508 KB |
Expected integer, but "000000000000000000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
226 ms |
3292 KB |
Expected int32, but "10110101010011010" found |
2 |
Halted |
0 ms |
0 KB |
- |