# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1235122 | dizzy_groovy | 순열 (APIO22_perm) | C++20 | 1 ms | 324 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> construct_permutation(long long k)
{
vector<int> p;
int cur = 1;
for (int i = 0; (1 << (i + 1)) < k; i++) {
cur *= 2;
p.push_back(i);
}
int n = p.size();
while (k - cur > 0) {
int x = __lg(k - cur);
for (int i = x; i < n; i++) {
p[i]++;
}
p.push_back(x);
cur += (1 << x);
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |