# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169454 | 2019-12-20T12:37:01 Z | SamAnd | "The Lyuboyn" code (IZhO19_lyuboyn) | C++17 | 131 ms | 19320 KB |
#include <bits/stdc++.h> using namespace std; const int N = 20; int n, k, tt; int a[1 << N]; bool c[1 << N]; vector<int> v; void rec(int i) { if (i == (1 << n)) { printf("%d\n", (1 << n)); for (int i = 0; i < (1 << n); ++i) { for (int j = 0; j < n; ++j) { if ((a[i] & (1 << j))) putchar('1'); else putchar('0'); } putchar('\n'); } exit(0); } for (int j = 0; j < v.size(); ++j) { int x = (a[i - 1] ^ v[j]); if (!c[x]) { c[x] = true; a[i] = x; rec(i + 1); c[x] = false; } } } int qan(int x) { int q = 0; for (int i = 0; i < n; ++i) { if ((x & (1 << i))) ++q; } return q; } char s[N]; int main() { //freopen("input.txt", "r", stdin); scanf("%d%d%d", &n, &k, &tt); for (int x = 0; x < (1 << n); ++x) { if (qan(x) == k) v.push_back(x); } scanf(" %s", s); if (k % 2 == 0) { printf("-1\n"); return 0; } int x = 0; for (int i = 0; i < n; ++i) { if (s[i] == '1') x |= (1 << i); } a[0] = x; c[x] = true; rec(1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Ok |
2 | Correct | 9 ms | 376 KB | Ok |
3 | Correct | 6 ms | 580 KB | Ok |
4 | Correct | 2 ms | 256 KB | Ok |
5 | Correct | 2 ms | 256 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 376 KB | Ok |
8 | Correct | 5 ms | 376 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 124 ms | 18936 KB | Ok |
2 | Correct | 61 ms | 9592 KB | Ok |
3 | Correct | 2 ms | 376 KB | Ok |
4 | Correct | 2 ms | 376 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 5 ms | 888 KB | Ok |
3 | Correct | 61 ms | 9496 KB | Ok |
4 | Correct | 30 ms | 4984 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 3 ms | 504 KB | Ok |
7 | Correct | 15 ms | 2552 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 125 ms | 19152 KB | Ok |
2 | Correct | 124 ms | 19064 KB | Ok |
3 | Correct | 124 ms | 19064 KB | Ok |
4 | Correct | 61 ms | 9720 KB | Ok |
5 | Correct | 60 ms | 9504 KB | Ok |
6 | Correct | 30 ms | 4908 KB | Ok |
7 | Correct | 30 ms | 4856 KB | Ok |
8 | Correct | 16 ms | 2556 KB | Ok |
9 | Correct | 15 ms | 2680 KB | Ok |
10 | Correct | 8 ms | 1400 KB | Ok |
11 | Correct | 2 ms | 376 KB | Ok |
12 | Correct | 2 ms | 376 KB | Ok |
13 | Correct | 2 ms | 376 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 124 ms | 18936 KB | Ok |
2 | Correct | 61 ms | 9592 KB | Ok |
3 | Correct | 2 ms | 376 KB | Ok |
4 | Correct | 2 ms | 376 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 5 ms | 888 KB | Ok |
8 | Correct | 61 ms | 9496 KB | Ok |
9 | Correct | 30 ms | 4984 KB | Ok |
10 | Correct | 2 ms | 376 KB | Ok |
11 | Correct | 3 ms | 504 KB | Ok |
12 | Correct | 15 ms | 2552 KB | Ok |
13 | Correct | 2 ms | 376 KB | Ok |
14 | Correct | 125 ms | 19152 KB | Ok |
15 | Correct | 124 ms | 19064 KB | Ok |
16 | Correct | 124 ms | 19064 KB | Ok |
17 | Correct | 61 ms | 9720 KB | Ok |
18 | Correct | 60 ms | 9504 KB | Ok |
19 | Correct | 30 ms | 4908 KB | Ok |
20 | Correct | 30 ms | 4856 KB | Ok |
21 | Correct | 16 ms | 2556 KB | Ok |
22 | Correct | 15 ms | 2680 KB | Ok |
23 | Correct | 8 ms | 1400 KB | Ok |
24 | Correct | 2 ms | 376 KB | Ok |
25 | Correct | 2 ms | 376 KB | Ok |
26 | Correct | 2 ms | 376 KB | Ok |
27 | Correct | 124 ms | 18996 KB | Ok |
28 | Correct | 61 ms | 9596 KB | Ok |
29 | Correct | 124 ms | 19192 KB | Ok |
30 | Correct | 8 ms | 1400 KB | Ok |
31 | Correct | 2 ms | 380 KB | Ok |
32 | Correct | 5 ms | 888 KB | Ok |
33 | Correct | 16 ms | 2524 KB | Ok |
34 | Correct | 2 ms | 376 KB | Ok |
35 | Correct | 2 ms | 256 KB | Ok |
36 | Correct | 2 ms | 376 KB | Ok |
37 | Correct | 2 ms | 376 KB | Ok |
38 | Correct | 60 ms | 9532 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 9464 KB | Ok |
2 | Correct | 123 ms | 18916 KB | Ok |
3 | Correct | 131 ms | 19320 KB | Ok |
4 | Correct | 8 ms | 1400 KB | Ok |
5 | Correct | 2 ms | 376 KB | Ok |
6 | Correct | 16 ms | 2552 KB | Ok |
7 | Correct | 124 ms | 19064 KB | Ok |
8 | Correct | 2 ms | 376 KB | Ok |
9 | Correct | 2 ms | 376 KB | Ok |
10 | Correct | 2 ms | 376 KB | Ok |
11 | Correct | 30 ms | 4860 KB | Ok |
12 | Correct | 61 ms | 9592 KB | Ok |