# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636795 | 2022-08-30T08:40:38 Z | valerikk | "The Lyuboyn" code (IZhO19_lyuboyn) | C++17 | 393 ms | 6240 KB |
#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; } printf("%d\n", 1 << N); 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Ok |
2 | Correct | 0 ms | 212 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 0 ms | 212 KB | Ok |
5 | Correct | 0 ms | 212 KB | Ok |
6 | Correct | 0 ms | 212 KB | Ok |
7 | Correct | 1 ms | 212 KB | Ok |
8 | Correct | 0 ms | 212 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 393 ms | 6240 KB | Fail, not exactly k bits are different: line = 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Fail, not exactly k bits are different: line = 15 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 392 ms | 6204 KB | Fail, not exactly k bits are different: line = 51 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 393 ms | 6240 KB | Fail, not exactly k bits are different: line = 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 174 ms | 3144 KB | Fail, not exactly k bits are different: line = 58950 |
2 | Halted | 0 ms | 0 KB | - |