답안 #583671

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
583671 2022-06-26T02:56:50 Z KoD "The Lyuboyn" code (IZhO19_lyuboyn) C++17
14 / 100
231 ms 6536 KB
#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);
    std::cout << (1 << N) << '\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 Correct 1 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Fail, not exactly k bits are different: line = 3
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 212 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 220 ms 6536 KB Ok
2 Correct 96 ms 3236 KB Ok
3 Correct 1 ms 340 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Fail, not exactly k bits are different: line = 3
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 231 ms 6396 KB Fail, not exactly k bits are different: line = 3
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 220 ms 6536 KB Ok
2 Correct 96 ms 3236 KB Ok
3 Correct 1 ms 340 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
6 Incorrect 0 ms 212 KB Fail, not exactly k bits are different: line = 3
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 128 ms 3292 KB Fail, not exactly k bits are different: line = 3
2 Halted 0 ms 0 KB -