# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725005 | hollwo_pelw | Permutation (APIO22_perm) | C++17 | 1 ms | 284 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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
if (k == 1) return {};
if (k == 2) return {0};
if (k == 3) return {1, 0};
vector<int> bits;
for (; k; k /= 4)
bits.push_back(k % 4);
bool have3 = 0;
int used_for_3 = 0;
vector<int> p;
if (bits.back() == 1) {
p = {};
} else if (bits.back() == 2) {
p = {0};
} else { // == 3
have3 = 1;
p.push_back(-1e9);
p.push_back(-1e9-1);
}
bits.pop_back();
reverse(bits.begin(), bits.end());
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |