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 <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;
using ll = long long;
vi solve(ll k) {
if (k == 1) return {};
if (k == 2) return {0};
for (int i : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}) {
if (k % i == 0 && k > i) {
vi l = solve(i);
vi r = solve(k/i);
for (int &o : r) o += l.size();
l.insert(l.end(), r.begin(), r.end());
return l;
}
}
vi a = solve(k >> 1ll);
a.emplace_back(a.size());
a.insert(a.begin(), a.size());
return a;
}
vi construct_permutation(ll k) {
return solve(k);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |