Submission #1107076

#TimeUsernameProblemLanguageResultExecution timeMemory
1107076vladiliusPermutation (APIO22_perm)C++17
71.22 / 100
8 ms1460 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second vector<int> construct_permutation(ll k){ k--; const int A = 60; vector<ll> f(A + 1); f[1] = 1; for (int i = 2; i <= A; i++){ f[i] = 2 * f[i - 1] + 1; } vector<int> p; int cc = 5000; for (int i = A; i > 0; i--){ ll t = k / f[i]; while (t--){ for (int j = 1; j <= i; j++){ p.pb((cc - i + j)); } cc -= i; } k %= f[i]; } for (int& i: p) i = i - cc - 1; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...