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;
using ll = long long int;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
ll min(ll x, ll y){
return ((x < y) ? x : y);
}
ll max(ll x, ll y){
return ((x > y) ? x : y);
}
std::vector<int> restore_permutation(int n, int w, int r) {
for (ll i = 1; n > i; i++){
string s;
s.assign(n,'0');
for (ll j = 0; i > j; j++){
s[j] = '1';
}
add_element(s);
}
compile_set();
vector<int> p;
p.assign(n,-1);
vi checked;
checked.assign(n,0);
for (ll i = 0; n > i; i++){
for (ll j = 0; n > j; j++){
if (checked[j]) continue;
string s; s.resize(n);
for (ll k = 0; n > k; k++){
if (checked[k] || k == j) s[k] = '1';
else s[k] = '0';
}
bool res = check_element(s);
if (res){
p[j] = i;
checked[j] = true;
}
}
}
for (ll i = 0; n > i; i++){
if (!checked[i]) p[i] = n-1;
}
return p;
}
# | 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... |