# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1154778 | Sharky | Permutation (APIO22_perm) | C++17 | 0 ms | 324 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
void append(vector<int>& v, int x, bool bk = 1) {
map<int, int> e;
for (int& a : v) {
if (a > x) a++;
e[a]++;
}
for (int i = 0;; i++) if (!e.count(i)) {
if (bk) v.push_back(i);
else v.insert(v.begin(), i);
break;
}
}
const int big = 100000;
const int small = -1;
std::vector<int> construct_permutation(long long k) {
vector<int> ops;
while (k) {
ops.push_back(k % 4);
k /= 4;
}
reverse(ops.begin(), ops.end());
vector<int> p;
for (int i : ops) {
if (p.empty()) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |