# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636794 | valerikk | "The Lyuboyn" code (IZhO19_lyuboyn) | C++17 | 328 ms | 6316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int N, K, T;
int f[1 << 19];
int main() {
scanf("%d%d%d", &N, &K, &T);
static char S[19];
scanf("%s", S);
int S_num = 0;
for(int i = 0; i < N; ++i) {
if(S[i] == '1') S_num |= 1 << i;
}
if(!(K&1)) {
puts("-1");
return 0;
}
int M = 1 << K + 1;
f[0] = 0;
f[1] = 1;
for(int p = 2; p < M; p <<= 1) {
for(int i = 0; i < p; ++i) {
f[p + i] = f[p - i - 1] | p;
}
}
for(int i = 1; i < M; i += 2) {
f[i] = f[i] ^ (M - 1);
}
for(int p = M; p < 1 << N; p <<= 1) {
for(int i = 0; i < p; ++i) {
f[p + i] = f[p - i - 1] ^ (M - 1) | p;
}
}
int S_pos = 0;
while(f[S_pos] != S_num) {
++S_pos;
}
for(int i = 0; i < 1 << N; ++i) {
int X = f[S_pos + i & (1 << N) - 1];
for(int j = 0; j < N; ++j) {
printf("%d", (X >> j) & 1);
}
printf("\n");
}
}
Compilation message (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... |