# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745129 | Desh03 | Permutation (APIO22_perm) | C++17 | 0 ms | 212 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.
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
int lg = 0;
while ((1LL << (lg + 1)) <= k) ++lg;
vector<int> ans(lg, -1), ret;
for (int i = lg - 1; i >= 0; --i)
if (k >> i & 1)
ans[i] = lg++;
for (int i = 0; i < ans.size(); i++)
if (ans[i] ^ -1) ret.push_back(ans[i]);
else ret.push_back(i);
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |