# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730760 | alextodoran | Permutation (APIO22_perm) | C++17 | 2 ms | 340 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.
/**
_ _ __ _ _ _ _ _ _
|a ||t ||o d | |o |
| __ _| | _ | __| _ |
| __ |/_ | __ /__\ / _\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector <int> construct_permutation (ll k) {
int bits = 63 - __builtin_clzll(k);
int len = bits + __builtin_popcountll(k) - 1;
if (true) {
vector <int> p;
int l = 0, r = len - 1;
for (int e = 0; e < bits; e++) {
if ((k >> e) & 1) {
p.push_back(r--);
}
p.push_back(l++);
}
return p;
} else {
vector <int> p = construct_permutation(k / 3);
int len = (int) p.size();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |