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>
#include "messy.h"
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
using namespace std;
#define vint vector<int>
int ng, wg, rg;
vector<int> anss;
void get_range(int l, int r)
{
if(l == r){
return;
}
vector<string> ans;
string now;
for(int i = 0; i < ng; i++)
{
now.push_back('0');
}
for(int i = 0; i < ng; i++)
{
if(i < l || i > r)
{
now[i] = '1';
}
}
for(int i = l; i <= (l+r)/2; i++)
{
now[i] = '1';
add_element(now);
now[i] = '0';
}
get_range(l, (l+r)/2);
get_range((l+r)/2+1, r);
}
void get_ans(int l, int r, vector<int> idx)
{
if(l == r)
{
anss[idx[0]] = l;
return;
}
string now;
for(int i = 0; i < ng; i++)
{
now.push_back('1');
}
for(auto x : idx)
{
now[x] = '0';
}
vector<int> left, right;
for(auto x : idx)
{
now[x] = '1';
if(check_element(now))
{
left.push_back(x);
}
else
{
right.push_back(x);
}
now[x] = '0';
}
get_ans(l, (l+r)/2, left);
get_ans((l+r)/2+1, r, right);
}
vector<int> restore_permutation(int n, int w, int r)
{
ng = n;
wg = w;
rg = r;
get_range(0, n-1);
anss.resize(n);
compile_set();
vector <int> idx;
for (int i = 0; i < n; i++) {
idx.push_back(i);
}
get_ans(0, n - 1,idx);
return anss;
}
# | 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... |