# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897014 | vjudge1 | Permutation (APIO22_perm) | C++17 | 537 ms | 1508 KiB |
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;
#define ll long long
const int N = 5e3+3, M = 3e2+2, X = 3e2+2;
const ll L = 62;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> construct_permutation(ll k)
{
vector<int> p;
if (!k) return p;
ll K = k;
k--;
int r = N;
//vector<int> p2;
for (int j = L; j > 0; j--) {
//cerr << k << " " << j << " " << (1ll << j) << " " << (1ll << j) - 1ll << endl;
if (k >= (1ll << j) - 1ll) {
k -= (1ll << j) - 1ll;
for (int l = 1; l <= j; l++) {
/*p2*/p.push_back(r-j+l);
}
//cerr << j << endl;
r -= j;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |