Submission #583671

#TimeUsernameProblemLanguageResultExecution timeMemory
583671KoD"The Lyuboyn" code (IZhO19_lyuboyn)C++17
14 / 100
231 ms6536 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...