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<iostream>
#include"perm.h"
using namespace std;
typedef long long ll;
vector<int>construct_permutation(ll k){
int num_pow=2;
while((1LL<<num_pow)<=k){
num_pow++;
}
num_pow--;
vector<int>res;
k-=1LL<<num_pow;
int curr=num_pow;
for(int i=0;i<num_pow;i++)
if(k&(1LL<<i))
curr++;
for(int i=0;i<num_pow;i++){
if(k&(1LL<<i)){
res.push_back(--curr);
}
res.push_back(i);
}
/*for(int i:res)
cout<<i<<" ";
cout<<"\n";*/
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |