Submission #982744

#TimeUsernameProblemLanguageResultExecution timeMemory
982744vjudge1Permutation (APIO22_perm)C++17
91.33 / 100
2 ms512 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...