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;
std::vector<int> construct_permutation(long long k)
{
if (k <= 10) {
vector<int> perm(k-1);
iota(perm.begin(), perm.end(), 0ll);
reverse(perm.begin(), perm.end());
return perm;
}
if (k%2 == 1) {
vector<int> res = construct_permutation(k-1);
res.insert(res.begin(), res.size());
return res;
} else {
vector<int> res = construct_permutation(k/2);
for (auto &x: res) x+=2;
res.insert(res.begin(), 1);
res.insert(res.begin(), 0);
return res;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |