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<ll,ll>;
using ld = long double;
ll l2(ll x) {
return (31-__builtin_clz(x));
}
vector<int> construct_permutation(ll KC) {
ll K = KC;
ll lk = l2(K);
vector<pair<ld,int>> v1;
for (ll i=0;i<lk;i++) {
v1.push_back({(ld)i,i});
}
K -= (1LL<<lk);
ll T = lk;
while (K>0) {
ll lv = l2(K);
v1.push_back({((ld)lv-0.5),T++});
K -= (1LL<<lv);
}
sort(v1.begin(),v1.end());
vector<int> vout;
for (auto A: v1) {
vout.push_back(A.second);
}
return vout;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |