This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |