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 n;
vector<int> restore_permutation(int _N, int w, int r) {
n = _N;
string s = string(n, '1');
for (int i = 0;i < n;i++) {
s[i] = '0';
add_element(s);
}
compile_set();
vector<int> ans(n);
string now = string(n, '1');
for (int i = 0;i < n;i++) {
int idx = 0;
for (int j = 0;j < n;j++) {
if (now[j] == '0') continue;
string q = now;
q[j] = '0';
if (check_element(q)) {
idx = j;
break;
}
}
// p[idx] = i
now[idx] = '0';
ans[idx] = i;
}
return ans;
}
# | 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... |