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;
using ll = long long;
vector<int> construct_permutation(ll k) {
int p = 63 - __builtin_clzll(k);
int v = __builtin_popcountll(k) - 1;
int u = v;
vector<int> ans;
for (int i = p - 1; i >= 0; i--) {
ans.push_back(u++);
if (k >> i & 1) {
ans.push_back(--v);
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |