Submission #1088675

#TimeUsernameProblemLanguageResultExecution timeMemory
1088675Math4Life2020Permutation (APIO22_perm)C++17
91.33 / 100
2 ms604 KiB
#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 (63-__builtin_clzll(x)); } vector<int> construct_permutation(ll KC) { ll K = KC; ll lk = l2(K); vector<pair<ld,ll>> 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((int)A.second); } return vout; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...