#include <bits/stdc++.h>
#include "perm.h"
using namespace std;
#define ll long long
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ve vector
#define all(x) x.begin(), x.end()
#define fo(i,a,b) for (int i=(a); i<=(b); ++i)
#define fd(i,a,b) for (int i=(a); i>=(b); --i)
#define popcount(x) __builtin_popcountll(x)
#define maxi(a, b) a = max(a, b)
#define mini(a, b) a = min(a, b)
#define siz(x) ((int)(x).size())
#define vi ve<int>
#define _ << ' ' <<
const int N = 1e6+5, inf = 1e9+10, mod = 1e9+7;
const ll lim = 1e18+5;
mt19937_64 rng((ll)(new char));
int rand(int l, int r) {
return rng() % (r - l + 1) + l;
}
vi construct_permutation(ll k) {
assert(k > 0);
if (k == 1) return {};
if (k == 2) return {0};
int sub = rand(0, 10);
while (sub >= k) sub = rand(1, 10);
vi res = construct_permutation(k - sub);
fo(i,1,sub) res.insert(res.begin(), siz(res));
return res;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |