| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364364 | not_amir | Permutation (APIO22_perm) | C++20 | 1 ms | 344 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> construct_permutation(ll k)
{
k--;
vector<int> p;
vector<ll> cnt;
while (k) {
ll c = 1;
int i = 0;
while (i < cnt.size()) {
if (c + cnt[i] > k)
break;
c += cnt[i++];
}
k -= c;
cnt.push_back(c);
for (int &x : p)
if (x >= i)
x++;
p.push_back(i);
}
return p;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
