Submission #745132

#TimeUsernameProblemLanguageResultExecution timeMemory
745132Desh03Permutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include <bits/stdc++.h> using namespace std; vector<int> construct_permutation(long long k) { int lg = 0; while ((1LL << (lg + 1)) <= k) ++lg; vector<int> ans(lg, -1), ret; int j = lg; for (int i = lg - 1; i >= 0; --i) if (k >> i & 1) ans[i] = j++; for (int i = 0; i < lg; i++) { if (ans[i] ^ -1) ret.push_back(ans[i]); ret.push_back(i); } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...