| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1312312 | lmaobruh | Permutation (APIO22_perm) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.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};
if (rand(0, 2)) {
vi res = construct_permutation(k / 2);
res.pb(siz(res));
if (k % 2 == 0) return res;
res.insert(res.begin(), siz(res));
return res;
} else {
int sub = rand(1, 10);
vi res = construct_permutation(k - sub);
fo(i,1,sub) res.insert(res.begin(), siz(res));
return res;
}
}
void sol() {
}
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
if(fopen("A.inp","r")) {
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
}
int tc = 1; // cin >> tc;
fo(i,1,tc) sol();
return 0;
}
