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 <bits/stdc++.h>
using ll = long long;
using std::vector;
using std::array;
using std::pair;
using std::tuple;
template <class T>
constexpr T infty = std::numeric_limits<T>::max() / 2;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
vector<int> base;
int N, K, T;
std::string S;
std::cin >> N >> K >> T >> S;
const int first = std::stoi(S, 0, 2);
for (int i = 0; i < (1 << N); ++i) {
if (__builtin_popcount(i) == K) {
int x = i;
for (const int e : base) {
x = std::min(x, x ^ e);
}
if (x != 0) {
base.push_back(x);
}
}
}
if ((int)base.size() != N) {
std::cout << "-1\n";
return 0;
}
auto dfs = [&](auto&& dfs, const int n) -> vector<int> {
if (n == 0) {
return {0};
}
auto low = dfs(dfs, n - 1);
vector<int> ret(1 << n);
const int m = 1 << (n - 1);
for (int i = 0; i < m; ++i) {
ret[i] = low[i];
ret[2 * m - i - 1] = low[i] + m;
}
return ret;
};
const auto code = dfs(dfs, N);
for (int i = 0; i < (1 << N); ++i) {
int x = first;
for (int j = 0; j < N; ++j) {
if (code[i] >> j & 1) {
x ^= base[j];
}
}
for (int j = N - 1; j >= 0; --j) {
std::cout << (x >> j & 1);
}
std::cout << '\n';
}
return 0;
}
# | 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... |