#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
const int MAXN = 18;
vector<int> get_ans(int n, int k, int t) {
if (k % 2 == 0) {
return {};
}
if (k * 2 > n) {
vector<int> ans = get_ans(n, n - k, t);
for (int i = 1; i < (1 << n); i += 2) {
ans[i] = ((1 << n) - 1) ^ ans[i];
}
return ans;
}
if (k == 1) {
vector<int> ans = {0};
for (int i = 0; i < (1 << n) - 1; ++i) {
int t = ((i ^ (i + 1)) + 1) >> 1;
ans.push_back(ans.back() ^ t);
}
return ans;
}
return {};
}
signed main() {
int n, k, t;
cin >> n >> k >> t;
int s = 0;
for (int i = 0; i < n; ++i) {
char c;
cin >> c;
if (c == '1')
s += 1 << i;
}
vector<int> ans = get_ans(n, k, t);
if (ans.empty()) {
cout << -1 << '\n';
return 0;
}
s ^= ans[0];
cout << (1 << n) << '\n';
for (auto& x : ans) {
x ^= s;
bitset<MAXN> bs = x;
for (int i = 0; i < n; ++i)
cout << bs[i];
cout << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
0 ms |
212 KB |
Ok |
3 |
Correct |
0 ms |
212 KB |
Ok |
4 |
Correct |
0 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Correct |
0 ms |
212 KB |
Ok |
7 |
Correct |
1 ms |
212 KB |
Ok |
8 |
Correct |
0 ms |
212 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
6324 KB |
Ok |
2 |
Correct |
109 ms |
3264 KB |
Ok |
3 |
Correct |
1 ms |
212 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
6324 KB |
Ok |
2 |
Correct |
109 ms |
3264 KB |
Ok |
3 |
Correct |
1 ms |
212 KB |
Ok |
4 |
Correct |
1 ms |
212 KB |
Ok |
5 |
Correct |
0 ms |
212 KB |
Ok |
6 |
Incorrect |
0 ms |
212 KB |
Output -1 while solution exists |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |