This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// ItnoE
#include<bits/stdc++.h>
#include "messy.h"
using namespace std;
const int N = 179;
int n, P[N];
void Solve(int l, int r, vector < int > vec)
{
assert((int)vec.size() == r - l);
if (r - l == 1)
{
P[vec[0]] = l;
return ;
}
int md = (l + r) >> 1;
vector < int > vel, ver;
string def = "";
for (int i = 0; i < n; i ++)
def += "1";
for (int v : vec)
{
string s = def;
for (int u : vec)
s[u] = '0';
s[v] = '1';
if (check_element(s))
vel.push_back(v);
else
ver.push_back(v);
}
Solve(l, md, vel);
Solve(md, r, ver);
}
vector < int > restore_permutation(int _n, int w, int r)
{
n = _n;
for (int len = 2; len <= n; len <<= 1)
for (int l = 0, r = len; r <= n; l += len, r += len)
{
int md = (l + r) >> 1;
for (int i = l; i < md; i ++)
{
string s = "";
for (int j = 0; j < n; j ++)
s += "1";
for (int j = l; j < i; j ++)
s[j] = '0';
for (int j = i + 1; j < r; j ++)
s[j] = '0';
add_element(s);
}
}
compile_set();
vector < int > vec;
for (int i = 0; i < n; i ++)
vec.push_back(i);
Solve(0, n, vec);
vector < int > ret;
for (int i = 0; i < n; i ++)
ret.push_back(P[i]);
return (ret);
}
# | 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... |