# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770027 | rainboy | "The Lyuboyn" code (IZhO19_lyuboyn) | C11 | 304 ms | 5304 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 <stdio.h>
#define N 18
int count(int b) {
return b == 0 ? 0 : count(b & b - 1) + 1;
}
int bb_[N], n;
int add(int b) {
int i;
for (i = 0; i < n; i++)
if (b & 1 << i) {
if (bb_[i] & 1 << i)
b ^= bb_[i];
else {
bb_[i] = b;
return 1;
}
}
return 0;
}
int main() {
static char cc[N + 1];
static int bb[N];
int m, k, i, b, b_, x, x_;
scanf("%d%d%*d%s", &n, &k, cc);
x = 0;
for (i = 0; i < n; i++)
if (cc[i] == '1')
x |= 1 << i;
m = 0;
for (b = 0; b < 1 << n; b++)
if (count(b) == k && add(b))
bb[m++] = b;
if (m < n) {
printf("-1\n");
return 0;
}
printf("%d\n", 1 << n);
for (b = 0; b < 1 << n; b++) {
b_ = b ^ b >> 1;
x_ = x;
for (i = 0; i < n; i++)
if ((b_ & 1 << i) != 0)
x_ ^= bb[i];
for (i = 0; i < n; i++)
printf("%d", x_ >> i & 1);
printf("\n");
}
return 0;
}
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... |