| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357469 | kawhiet | Permutation (APIO22_perm) | C++20 | 1 ms | 344 KiB |
#include <bits/stdc++.h>
#include "perm.h"
using namespace std;
vector<int> construct_permutation(long long k) {
int l = 1, r = 5000;
vector<int> a;
while (k > 1) {
if (k & 1) {
k--;
a.push_back(r--);
} else {
k /= 2;
a.push_back(l++);
}
}
vector<int> b = a;
ranges::sort(b);
for (auto &x : a) {
x = ranges::lower_bound(b, x) - b.begin();
}
return a;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
