Submission #1012731

#TimeUsernameProblemLanguageResultExecution timeMemory
1012731codefoxPermutation (APIO22_perm)C++17
91.33 / 100
1 ms508 KiB
#include<bits/stdc++.h> #include "perm.h" using namespace std; std::vector<int> construct_permutation(long long k) { int l = 0; for (int i = 62; i>= 0; i--) { if (k&(1LL<<i)) l =max(l,i); } vector<int> sol(l); iota(sol.begin(), sol.end(), 0); for (int i = l-1; i >= 0; i--) { if (k&(1LL<<i)) { sol.push_back(0); for (int j = sol.size()-1; j >i; j--) { sol[j] = sol[j-1]; } sol[i] = l++; } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...