# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975926 | Orifkhon | Permutation (APIO22_perm) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
vector<int> construct_permutation(long long k) {
int z = __lg(k);
vector<int> p(z);
iota(p.begin(), p.end(), 0);
for (int i = z - 1; i >= 0; i--) {
if ((k >> i) & 1) {
p.insert(p.begin() + i, z++);
}
}
return p;
}