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 <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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |