This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |