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>
using namespace std;
vector<int> construct_permutation(long long k){
k--;
vector<int> v;
for(long long i = 0;i<60;i++){
if((1LL<<i)<=k){
k-=(1LL<<i);
v.push_back(i);
}
}
for(long long i = 59;i>=0;i--){
while((1LL<<i)<=k){
long long xd = i;
for(int j = v.size()-1;j>=xd;j--){
v[j]++;
}
v.push_back(i);
k-=(1LL<<i);
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |