Submission #762814

#TimeUsernameProblemLanguageResultExecution timeMemory
762814NK_"The Lyuboyn" code (IZhO19_lyuboyn)C++17
100 / 100
23 ms6356 KiB
// Success consists of going from failure to failure without loss of enthusiasm #include <bits/stdc++.h> using namespace std; #define nl '\n' using str = string; template<class T> using V = vector<T>; int main() { cin.tie(0)->sync_with_stdio(0); int N, K, T; cin >> N >> K >> T; str S; cin >> S; if (K % 2 == 0) { cout << -1 << nl; return 0; } V<pair<int, int>> A; for(int x = 0; x < (1 << N); x++) if (__builtin_popcount(x) == K) { pair<int, int> cur = {x, x}; for(auto p : A) cur.first = min(cur.first, p.first ^ cur.first); if (!cur.first) continue; for(int i = 0; i <= int(size(A)); i++) if (i == int(size(A)) || cur.first > A[i].first) { A.insert(begin(A) + i, cur); break; } } // cout << 1 << endl; V<int> dif(1<<N); for(int i = 0; i < N; i++) for(int j = (1 << i); j < (1 << N); j += (2 << i)) dif[j] = A[i].second; cout << (1 << N) << nl; for(int i = 0; i < (1 << N); i++) { for(int j = 0; j < N; j++) if ((dif[i] >> j) & 1) S[j] = '0' + '1' - S[j]; cout << S << nl; } 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...