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 <vector>
#include <iostream>
#include "messy.h"
std::vector<int> restore_permutation(int n, int w, int r) {
std::string S;
int i, j, k, lgN;
for (lgN = 0; (1 << lgN) < n; lgN++);
// std::cout << lgN << "\n";
for (i = 0; i < n; i++)
S.push_back('0');
for (i = lgN - 1; i >= 0; i--)
{
// std::cout << "i = " << i << "\n";
for (j = 0; j < n; j++)
{
if (j&(1 << i))
{
for (k = 0; k < n; k++)
{
if ((k^j) < (1 << (i + 1)))
S[k] = '0';
else
S[k] = '1';
}
S[j] = '1';
// std::cout << S << "\n";
add_element(S);
}
}
}
// std::cout << "Compile Set\n";
compile_set();
std::vector<int> V, Vnew;
std::vector<int> Ans;
for (i = 0; i < n; i++)
{
V.push_back(0);
S[i] = '0';
}
for (i = lgN - 1; i >= 0; i--)
{
Vnew = V;
for (j = 0; j < n; j++)
{
for (k = 0; k < n; k++)
{
if (V[k] == V[j])
S[k] = '0';
else
S[k] = '1';
}
S[j] = '1';
// std::cout << S << "\n";
if (check_element(S))
{
Vnew[j] += (1 << i);
}
}
V = Vnew;
}
return V;
}
# | 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... |