| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1362443 | aaaaaaaa | Permutation (APIO22_perm) | C++20 | 0 ms | 360 KiB |
#include <bits/stdc++.h>
#include "perm.h"
using namespace std;
vector<int> construct_permutation(long long k) {
vector<int> ops;
while (k > 1) {
if (k % 2 == 0) {
ops.push_back(0);
k /= 2;
} else {
ops.push_back(1);
k -= 1;
}
}
reverse(ops.begin(), ops.end());
vector<int> ans;
int cur = 0;
for (auto op : ops) {
if (op == 0) {
ans.insert(ans.begin(), cur++);
} else {
ans.push_back(cur++);
}
}
return ans;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
