제출 #1135299

#제출 시각아이디문제언어결과실행 시간메모리
1135299hamzabc"The Lyuboyn" code (IZhO19_lyuboyn)C++20
100 / 100
177 ms8528 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define mod 1000000007 #define sp << " " << #define endl << '\n' long long int N, K, T; vector<long long int> out; long long int shifter(long long int n){ if (N % K == 0){ if (n == N - 1) return (1 << (K - 1)) - 1 + (1 << (N - 1)); long long int temp = (1LL << n) * ((1LL << K) - 1); return temp % (1LL << (N - 1)) + temp / (1LL << (N - 1)); } long long int temp = (1LL << n) * ((1LL << K) - 1); return temp % (1LL << N) + temp / (1LL << N); } void dp(long long int say, int n=0, bool mirored=false){ if (n == N){ out.push_back(say); return; } if (mirored){ dp(say ^ shifter(n), n + 1, false); dp(say, n + 1, true); }else{ dp(say, n + 1, false); dp(say ^ shifter(n), n + 1, true); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N >> K >> T; long long int S = 0; for (int i = 0; i < N; i++){ char k; cin >> k; S += (k == '1') * (1 << i); } dp(S); vector<int> table(1 << N); for (int i : out){ if (table[i]){ cout << -1; return 0; } table[i]++; } cout << (1 << N) endl; for (int i : out){ for (int o = 0; o < N; o++){ if (i & (1 << o)){ cout << 1; }else{ cout << 0; } } cout endl; } 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...