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> ans;
int cnt = 0; k--;
for(int i = 59; i >= 0; i--){
if(k >= (1ll<<(i+1)) - 1){
int lcnt = cnt;
cnt += i + 1;
k -= (1ll<<(i+1)) - 1;
for(int i = cnt; i > lcnt; i--){
ans.push_back(i - 1);
}
}
}
if(k) ans.push_back(cnt);
reverse(ans.begin(), ans.end());
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |