#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) {
return {};
}
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 |
Incorrect |
0 ms |
212 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Ok |
2 |
Correct |
1 ms |
340 KB |
Ok |
3 |
Correct |
1 ms |
212 KB |
Ok |
4 |
Correct |
0 ms |
212 KB |
Ok |
5 |
Correct |
1 ms |
300 KB |
Ok |
6 |
Correct |
0 ms |
212 KB |
Ok |
7 |
Correct |
0 ms |
212 KB |
Ok |
8 |
Correct |
0 ms |
300 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
248 ms |
6452 KB |
Ok |
2 |
Correct |
113 ms |
3212 KB |
Ok |
3 |
Correct |
1 ms |
212 KB |
Ok |
4 |
Correct |
0 ms |
304 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
248 ms |
6452 KB |
Ok |
2 |
Correct |
113 ms |
3212 KB |
Ok |
3 |
Correct |
1 ms |
212 KB |
Ok |
4 |
Correct |
0 ms |
304 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
6 |
Incorrect |
1 ms |
212 KB |
Output -1 while solution exists |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output -1 while solution exists |
2 |
Halted |
0 ms |
0 KB |
- |