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 ll long long
#define sz size()
#define pb push_back
vector<int> construct_permutation(ll k){
if(k==1)return {};
if(k&1){
vector<int> ans=construct_permutation(k-1);
for(int &el:ans)el++;
ans.pb(0);
return ans;
}
vector<int> v=construct_permutation(k>>1);
vector<int> ans;
ans.pb(0);
for(int el:v)ans.pb(el+1);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |