# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
912277 | TienDungz | 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"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> construct_permutation(long long n)
{
vector<int> res;
bool ok = true;
int p = 0;
for (int j = 60; j >= 0; j--) {
int m = 1LL << j;
if (n - m >= 0) {
n -=m;
if (ok) {
ok = false;
for (int i = 1; i <= j; i++) {
res.push_back(2 * i);
}
p = j;
} else {
res.push_back(2 * j + 1);
}
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |