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;
// Template
// ==============================================
typedef long long ll;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PI;
typedef vector<pair<int, int>> VPI;
#define pb push_back
#define ff first
#define ss second
#define loop(i, s, e) for (int i = s; i < e; ++i)
#define inp(v) for (auto& x : v) cin >> x
#define all(a) a.begin(), a.end()
#define revall(a) a.rbegin(), a.rend()
#define nl "\n"
#define MOD 998244353
// #define MOD 1000000007
#define MAXN 100001
#define INF (int) 1e9
#define MINF (int) -1e9
// ==============================================
std::vector<int> construct_permutation(long long k)
{
VI a;
int len = __lg(k);
loop(i, 0, len) a.pb(i);
k -= 1LL << len;
int nxt = len;
for (int i = len; i >= 0; --i)
{
if (k & (1LL << i)) a.insert(a.begin() + i, nxt++);
}
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |