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.push_back(x[0]);
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++)
{
al.push_back(i);
}
pus(0,N,al);
return an;
}
Compilation message (stderr)
messy.cpp: In function 'void pus(int, int, std::vector<int>)':
messy.cpp:43:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(i=0;i<x.size();i++)
| ~^~~~~~~~~
messy.cpp:49:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
49 | for(i=0;i<x.size();i++)
| ~^~~~~~~~~
# | 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... |