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 <bits/stdc++.h>
#include "perm.h"
using namespace std;
vector<int> construct_permutation(long long k)
{
if (k == 1)
return {};
for (int q : {2, 3, 5, 7, 11, 13, 17, 19, 23})
if (!(k % q) && k > q)
{
auto p = construct_permutation(k / q);
auto s = construct_permutation(q);
for (int &x : s)
x += p.size();
p.insert(p.end(), s.begin(), s.end());
return p;
}
auto p = construct_permutation(k >> 1);
p.push_back(p.size());
p.insert(p.begin(), p.size());
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |