# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388894 | jjang36524 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 3 ms | 464 KiB |
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 <vector>
#include "messy.h"
using namespace std;
int N;
void pus(int s,int e)
{
if(s+1==e)
return;
string st;
int i;
for(i=0;i<N;i++)
{
st.push_back('0');
}
for(i=s;i<e;i++)
{
st[i]='1';
}
for(i=s;i<(e+s)/2;i++)
{
st[i]='0';
add_element(st);
st[i]='1';
}
pus(s,(s+e)/2);
pus((s+e)/2,e);
}
vector<int>an;
void pus(int s,int e,vector<int>x)
{
if(s+1==e)
{
an[x[0]]=s;
return;
}
string st;
int i;
for(i=0;i<N;i++)
{
st.push_back('0');
}
for(i=0;i<x.size();i++)
{
st[x[i]]='1';
}
vector<int>l;
vector<int>r;
for(i=0;i<x.size();i++)
{
st[x[i]]='0';
int a=check_element(st);
if(a)
l.push_back(x[i]);
else
r.push_back(x[i]);
st[x[i]]='1';
}
pus(s,(s+e)/2,l);
pus((s+e)/2,e,r);
}
std::vector<int> restore_permutation(int n, int w, int r)
{
N=n;
pus(0,N);
compile_set();
vector<int>al;
int i;
for(i=0;i<n;i++)
{
an.push_back(0);
al.push_back(i);
}
pus(0,N,al);
return an;
}
Compilation message (stderr)
# | 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... |