Submission #911082

#TimeUsernameProblemLanguageResultExecution timeMemory
911082daoquanglinh2007"The Lyuboyn" code (IZhO19_lyuboyn)C++17
19 / 100
187 ms8776 KiB
#include <bits/stdc++.h> using namespace std; #define flipbit(x, i) x ^= (1<<(i)) string bS; int N, K, S, T; vector <int> v, ans; int cnt[262144]; vector <int> build(int N){ if (N == 1){ vector <int> ans = {0, 1}; return ans; } vector <int> a = build(N-1); for (int i = 0; i < (1<<(N-1)); i++){ a.push_back((1<<(N-1))+a[(1<<(N-1))-1-i]); } return a; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> K >> T >> bS; for (int i = 0; i < N; i++) if (bS[i] == '1') S += (1<<(N-1-i)); v = build(N); ans.clear(); ans.push_back(S); for (int i = 1; i < (1<<N); i++){ ans.push_back(ans[i-1]); for (int j = 0; j < N; j++) if (((v[i]^v[i-1])>>j)&1){ for (int t = 0; t < K; t++) flipbit(ans[i], (j+t)%N); } } for (int x : ans){ if (cnt[x]){ cout << -1; return 0; } cnt[x]++; } cout << (1<<N) << '\n'; for (int x : ans){ for (int i = N-1; i >= 0; i--) cout << ((x>>i)&1); 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...