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"
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
// srand(97);
set<int> pos;
for (int i = 1; i <= n; i++) {
string x(n, '0');
for (int j = 0; j < i; j++)
x[j] = '1';
add_element(x);
pos.insert(i-1);
}
compile_set();
string x(n, '0');
vector<int> ans(n);
for (int i = 0; i < n; i++) {
set<int> guess = pos;
while (!guess.empty()) {
auto g = guess.begin();
string t = x;
int ind = *g;
t[ind] = '1';
guess.erase(g);
// cout << t << ' ' << x << endl;
if (check_element(t)) {
ans[ind] = i;
x[ind] = '1';
pos.erase(ind);
break;
}
}
}
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... |