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;
#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int N = 2e5 + 5;
mt19937_64 rng(1773);
vector<int> restore_permutation(int n, int w, int r) {
string h = "";
for (int i = 0; i < n; i++) h += '0';
for (int i = 0; i < n - 1; i++) {
h[i] = '1';
add_element(h);
}
compile_set();
for (int i = 0; i < n; i++) h[i] = '0';
vector<int> p(n), s;
for (int i = 0; i < n; i++) s.push_back(i);
shuffle(all(s), rng);
for (int i = 0; i < n; i++) {
for (int j: s) {
if (h[j] == '1') continue;
h[j] = '1';
if (i == n - 1 || check_element(h)) {
p[j] = i;
break;
}
h[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... |