# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
345161 | koketsu | "The Lyuboyn" code (IZhO19_lyuboyn) | C++14 | 116 ms | 44068 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define Kultivator ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const LL Mxn = 1e6 + 7;
const LL Mod = 1e9 + 7;
const LL Inf = 1e14 + 7;
int N, K, T, Cnt;
vector <int> tran, Ans;
bool Used[Mxn];
int bom(string S){
int Ans = 0;
for(int i = 0; i < S.size(); i++){
Ans += ((S[i] - '0') << (S.size() - i - 1));
}
return Ans;
}
string rev(int V){
string F = "", t = "";
while(V > 0){
F += ((V % 2) + '0');
V /= 2;
}
int P = F.size();
for(int i = 0; i < N - P; i++){
F += '0';
}
reverse(F.begin(), F.end());
return F;
}
void Solve(int X){
Used[X] = true;
Ans.pb(X);
Cnt++;
if(Cnt == (1 << N)){
cout << Ans.size() << '\n';
for(int i : Ans){
cout << rev(i) << '\n';
}
exit(0);
}
for(int i : tran){
if(!Used[i ^ X]){
Solve(i ^ X);
}
}
}
int main() {
Kultivator;
string S;
cin >> N >> K >> T >> S;
if(K % 2 == 0) return cout << -1, 0;
for(int mask = 0; mask < (1 << N); mask++){
if(__builtin_popcount(mask) == K){
tran.pb(mask);
}
}
Solve(bom(S));
//cout << bom(S);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |