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 "messy.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
typedef long long lint;
vector<int> restore_permutation(int n, int w, int r) {
vector<int>ans;
for(int i=0;i<n;i++)ans.push_back(i);
string a,b;
for(int i=0;i<n;i++)a+='1';
for(int i=n;i>=2;i/=2)
{
for(int j=0;j<n;j+=i)
{
b=a;
for(int k=0;k<i;k++)b[j+k]='0';
for(int k=0;k<i/2;k++)
{
b[j+k]='1';
add_element(b);
b[j+k]='0';
}
}
}
compile_set();
int l=1;
vector<int>V[8][128];
for(int i=0;i<n;i++)V[0][0].push_back(i);
for(int i=n;i>=2;i/=2)
{
for(int j=0;j<n;j+=i)
{
b=a;
for(int k=0;k<i;k++)b[V[l-1][j][k]]='0';
for(int k=0;k<n;k++)
{
if(b[k]=='1')continue;
b[k]='1';
if(check_element(b))
{
V[l][j].push_back(k);
}
else
{
V[l][j+i/2].push_back(k);
}
b[k]='0';
}
}
l++;
}
for(int i=0;i<n;i++)ans[V[l-1][i][0]]=i;
return ans;
}
# | 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... |