# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1201226 | aykhn | Permutation (APIO22_perm) | C++20 | 1 ms | 328 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k)
{
int b = 0;
while ((1LL << (b + 1)) <= k) b++;
vector<int> res;
for (int i = b - 1; i >= 0; i--)
{
res.insert(res.begin(), -1);
for (int &j : res) j++;
if (k >> i & 1) res.insert(res.begin(), *max_element(res.begin(), res.end()) + 1);
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |