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;
using ll = long long;
vector<int> construct_permutation(ll k){
if (k == 1ll) return {};
if (k == 2ll) return {0};
for (int p : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31})
if (k%p == 0ll && k > p) {
vector<int> a = construct_permutation(p);
vector<int> b = construct_permutation(k/p);
for (auto& x : b)
x += a.size();
a.insert(a.end(), b.begin(), b.end());
return a;
}
vector<int> res = construct_permutation(k >> 1ll);
res.push_back(res.size());
res.insert(res.begin(), res.size());
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |