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"
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define sz(v) (ll)(v.size())
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
int pos = n - 1;
string s = "";
for(int i = 0; i < n; i++)
s += "0";
vector<string>vect;
for(int i = 0; i < n; i++)
{
s[pos] = '1';
vect.pb(s);
add_element(s);
pos--;
}
compile_set();
vector<int>perm(n);
for(int i = 0; i < n; i++)
perm[i] = i + 1;
set<ll>st;
s = "";
for(int i = 0; i < n; i++)
s += "0";
bool res;
for(int i = n - 1; i >= 0; i--)
{
for(int j = 0; j < n; j++)
{
s[j] = '1';
res = check_element(s);
if(res)
break;
}
for(int j = 0; j < n; j++)
{
if(st.count(j))
continue;
if(s[j] == '1')
{
perm[i] = j;
st.insert(j);
break;
}
}
}
return perm;
}
# | 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... |