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;
vector<int> construct_permutation(long long k){
vector<int> v;
int cur=1,i=0;
while(cur*2<k){
cur*=2;
v.push_back(i);
i++;
}
k-=cur;
while(k > 0){
cur=1;
int pos=0;
while(cur*2<=k){
pos++;cur*=2;
}
v.insert(v.begin()+pos,i);
i++;
k-=cur;
}
for(auto it: v) cout<<it<<' ';
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |