# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169454 | SamAnd | "The Lyuboyn" code (IZhO19_lyuboyn) | C++17 | 131 ms | 19320 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 <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 (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... |