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;
typedef long long ll;
vector<int>construct_permutation(ll k){
vector<int>ans;
for(int i = 63 - __builtin_clzll(k) - 1, current = 0, front_cnt = 0; i > -1; i--){
ans.emplace_back(current++);
if((1LL << i) & k){
if(i > 0 && front_cnt > 1 && ((1LL << (i - 1)) & k)){
ans.emplace_back(current++);
ans.insert(ans.begin() + 2, current++);
i--;
}
else{
ans.insert(ans.begin(), current++);
front_cnt++;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |