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;
vector<int> construct_permutation(long long k)
{
vector<int> a;
vector<int> ret;
while(k>0)
{
if(k%2==1)a.push_back(1);
else a.push_back(0);
k/=2;
}
int n=a.size();
int idx=0;
for(idx=0;idx<n-1;idx++)ret.push_back(idx);
for(int i=n-2;i>=0;i--)
{
if(a[i]==0)continue;
ret.insert(ret.begin()+i,idx++);
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |