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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> Solve(long long k) {
if (k == 0) {
return {};
}
if (k == 1) {
return vector<int>(1, 0);
}
vector<int> res;
vector<int> v = Solve(k / 2);
if (k % 2 == 1) {
res.push_back(2 * (int) v.size());
}
for (int i : v) {
res.push_back(i + (int) v.size());
}
for (int i : v) {
res.push_back(i);
}
return res;
}
vector<int> construct_permutation(long long k) {
return Solve(k);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |