Submission #572701

#TimeUsernameProblemLanguageResultExecution timeMemory
572701baluteshihPermutation (APIO22_perm)C++17
71.22 / 100
11 ms1364 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define X first #define Y second #define SZ(a) ((int)a.size()) #define ALL(v) v.begin(), v.end() #define pb push_back vector<int> construct_permutation(ll k) { vector<int> idx, rt; --k; for (ll x = 59; x > 0; --x) { while (k >= (1LL << x) - 1) { k -= (1LL << x) - 1; idx.pb(x); } } int nw = -1; for (int x : idx) { for (int i = nw + x; i > nw; --i) rt.pb(i); nw += x; } reverse(ALL(rt)); return rt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...