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) {
for (int i = n >> 1; i; i >>= 1) {
for (int j = 0; j < n; j += i << 1) {
string s(n, '0');
for (int k = 0; k < i << 1; ++k) {
s[j + k] = '1';
}
for (int k = 0; k < i; ++k) {
s[j + k + i] = '0';
add_element(s);
s[j + k + i] = '1';
}
}
}
compile_set();
vector<int> p(n);
for (int i = 0; i < n; ++i) {
p[i] = i;
}
for (int i = n >> 1; i; i >>= 1) {
for (int j = 0; j < n; j += i << 1) {
string s(n, '0');
for (int k = 0; k < i << 1; ++k) {
s[p[j + k]] = '1';
}
vector<int> left, right;
for (int k = 0; k < i << 1; ++k) {
s[p[j + k]] = '0';
if (check_element(s)) {
right.push_back(p[j + k]);
} else {
left.push_back(p[j + k]);
}
s[p[j + k]] = '1';
}
for (int k = 0; k < i; ++k) {
p[j + k] = left[k];
p[j + k + i] = right[k];
}
}
}
vector<int> ans(n);
for (int i = 0; i < n; ++i) {
ans[p[i]] = 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... |