#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
The output is neither -1 nor the length of the answer |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
320 KB |
Expected integer, but "0000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Ok |
2 |
Correct |
1 ms |
212 KB |
Ok |
3 |
Correct |
2 ms |
212 KB |
Ok |
4 |
Correct |
0 ms |
212 KB |
Ok |
5 |
Correct |
1 ms |
212 KB |
Ok |
6 |
Correct |
1 ms |
212 KB |
Ok |
7 |
Correct |
1 ms |
320 KB |
Ok |
8 |
Correct |
2 ms |
324 KB |
Ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
281 ms |
6392 KB |
Expected integer, but "000000000000000000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Expected integer, but "0000000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
212 ms |
6556 KB |
Expected integer, but "010101010011010100" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
281 ms |
6392 KB |
Expected integer, but "000000000000000000" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
91 ms |
3240 KB |
Expected integer, but "01011001010101101" found |
2 |
Halted |
0 ms |
0 KB |
- |