#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector < int > construct_permutation(ll k){
k--;
int x = 0, y = 0;
vector < int > ans[60];
for(ll bit = 59; bit >= 1; bit--){
while(k >= (1ll << bit) - 1){
k -= (1ll << bit) - 1, x++;
for(int i = 0; i < bit; i++) ans[x].push_back(y++);
}
}
for(int i = x; i >= 1; i--){
for(int val : ans[i]){
ans[0].push_back(val);
}
}
return ans[0];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |