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