Submission #956930

#TimeUsernameProblemLanguageResultExecution timeMemory
956930LaviniaTornaghiPermutation (APIO22_perm)C++17
10 / 100
1 ms604 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; vector<int> construct_permutation(long long k) { int last_digit = 63 - __builtin_clzll(k); int extras = __builtin_popcountll(k); vector<int> ans; int lo = extras - 2; int hi = extras - 1; for (int b = last_digit - 1; b >= 0; b--) { ans.push_back(hi++); if ((k >> b) & 1) ans.push_back(lo--); } assert(ans.size() <= 70); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...