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"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
srand(time(0));
string guess(n,'0');
for (int i = 0; i < n-1; i++) {
guess[i] = '1';
add_element(guess);
}
compile_set();
string check(n,'0');
vector<int> p(n,-1);
vector<int> indices(n);
iota(indices.begin(),indices.end(),0);
random_shuffle(indices.begin(),indices.end());
for (int i = 0; i < n; i++) {
for (int j: indices) {
if (check[j] == '1') continue;
check[j] = '1';
if (i == n-1 || check_element(check)) {
p[j] = i;
break;
}
check[j] = '0';
}
}
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... |