이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "messy.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll i,j,N,a[1010];
string s;
void buat(ll aa,ll bb)
{
if(aa==bb)return ;
ll besar=(bb-aa+1),ii;
string z;
for(ii=0;ii<N;ii++)z+="1";
for(ii=aa;ii<=bb;ii++)z[ii]='0';
for(ii=aa;ii<aa+(besar/2);ii++)
{
z[ii]='1';
add_element(z);
//cout<<z<<"\n";
z[ii]='0';
}
buat(aa,aa+besar/2-1);
buat(aa+besar/2,bb);
}
void cari(ll aa,ll bb,string cc)
{
//cout<<aa<<" "<<bb<<" "<<cc<<"\n";
ll ii;
if(aa==bb)
{
for(ii=0;ii<N;ii++)
if(cc[ii]=='0')
{
a[ii]=aa;
return ;
}
return ;
}
string ki=cc;
string ka=cc;
string tan=cc;
ll besar=(bb-aa+1);
for(ii=0;ii<N;ii++)
if(cc[ii]=='0')
{
tan[ii]='1';
if(check_element(tan))ka[ii]='1';
else ki[ii]='1';
tan[ii]='0';
}
cari(aa,aa+besar/2-1,ki);
cari(aa+besar/2,bb,ka);
}
std::vector<int> restore_permutation(int n, int w, int r) {
N=n;
buat(0,n-1);
compile_set();
for(i=0;i<n;i++)s+="0";
cari(0,n-1,s);
vector<int> has(n);
for(i=0;i<n;i++)
has[i]=a[i];
return has;
}
# | 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... |