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;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;
vi construct_permutation (ll k) {
vector <double> dans;
ll bits = 0;
{ll kk = k/2;
while (kk) {
dans.push_back(bits);
bits++;
kk /= 2;
}}
ll i = bits;
assert(k>>i&1);
for (i--; i >= 0; i--) {
if (k>>i&1) {
dans.push_back(-0.5+i);
}
}
vector <double> key(dans);
sort(key.begin(), key.end());
vi ans;
for (double i : dans) {
ans.push_back(lower_bound(key.begin(), key.end(), i)-key.begin());
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |