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;
using ll = long long;
std::vector<int> construct_permutation(long long k) {
bitset<64> bs(k);
vector<int> ans;
int n = (int)log2(k);
//int maxx=n-1;
int cur=n-1;
for(int i=0;i<n;i++){
ans.push_back(i);
}
n--;
while(n>=0){
if(bs[n]&1){
ans.insert(ans.begin()+n, ++cur);
}
n--;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |