이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// 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... |