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;
#define pii pair<int, int>
#define ll long long
const int MAX_N = 1e3;
void construct_k(ll k, int m, vector<int>& v){
if(k == 0LL || k== 1LL){
return;
}
else{
if(k%2LL == 0LL){
v.push_back(m++);
construct_k(k/2LL, m, v);
}
else{
construct_k(k-1LL, m+1, v);
v.push_back(m);
}
}
}
std::vector<int> construct_permutation(long long k)
{
vector<int> res;
construct_k(k, 0, res);
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |