# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
912362 | huyngo | Permutation (APIO22_perm) | C++17 | 0 ms | 348 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 "perm.h"
std::vector<int> construct_permutation(long long k)
{
std::vector<int> a;
long long l = 0, r = 0, dd = 0;
auto work = [&](auto self, long long x) -> void {
if (x & 1) {
a.push_back(--l);
dd = l;
self(self, x - 1);
}
else {
a.push_back(++r);
self(self, x >> 1);
}
};
for (auto& x : a)
x -= dd;
return a;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |