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"
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
string emp(n,'0');
for(int i = n>>1; i; i>>=1){
for(int j = 0; j < n; ++j){
if((j/i)&1)continue;
string s = emp;
s[j] = '1';
for(int k = 0; k < n; ++k){
if(j/i == k/i || ((j/i)^1) == k/i)continue;
s[k] = '1';
}
add_element(s);
}
}
compile_set();
vector<vector<int>> A[2];
vector<int> v(n);
iota(v.begin(),v.end(),0);
A[0].push_back(v);
int b = __lg(n);
for(int i = 0; i < b; ++i){
A[1].clear();
for(int j = 0; j < (1<<i); ++j){
vector<int> F,S;
string cu = emp;
for(int k = 0; k < (1<<i); ++k){
if(j == k)continue;
for(auto x : A[0][k])cu[x] = '1';
}
for(auto x : A[0][j]){
string s = cu;
s[x] = '1';
if(check_element(s))F.push_back(x);
else S.push_back(x);
}
A[1].push_back(F);
A[1].push_back(S);
}
swap(A[1],A[0]);
}
vector<int> ret(n);
for(int i = 0; i < n; ++i){
ret[A[0][i][0]] = 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... |