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==1)return {};
if(k==2)return {0};
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
vector<int> res;
for(int i:primes) {
if(k%i==0 and k>i) {
vector<int> l=construct_permutation(k/i), r=construct_permutation(i);
for(int &j:r) {
j+=l.size();
}
for(int j:r)l.push_back(j);
return l;
}
}
vector<int> c=construct_permutation(k/2);
c.push_back(c.size());
c.insert(c.begin(),c.size());
return c;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |