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 <algorithm>
#include <vector>
using namespace std;
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
vector<int> restore_permutation(int n, int, int) {
for (int z = n; z != 1; z >>= 1)
for (int l = 0; l != n; l += z) {
string s(n, '1');
rep(i, l, l + z) s[i] = '0';
rep(i, l, l + z / 2) {
s[i] = '1';
add_element(s);
s[i] = '0';
}
}
compile_set();
vector<int> p(n); rep(i, 0, n) p[i] = i;
for (int z = n; z != 1; z >>= 1) {
vector<bool> v(n);
for (int l = 0; l != n; l += z) {
string s(n, '1');
rep(i, l, l + z) s[p[i]] = '0';
rep(i, l, l + z) {
s[p[i]] = '1';
v[p[i]] = check_element(s);
s[p[i]] = '0';
}
partition(begin(p) + l, begin(p) + l + z, [&v](int x) { return v[x]; });
}
}
vector<int> q(n);
rep(i, 0, n) q[p[i]] = i;
return q;
}
# | 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... |