Submission #745260

#TimeUsernameProblemLanguageResultExecution timeMemory
745260speedyArdaPermutation (APIO22_perm)C++17
0 / 100
1 ms296 KiB
#include "perm.h" #include "bits/stdc++.h" using namespace std; vector<int> construct_permutation(long long k) { int beg = log2(k); vector<int> ans; for(int i = 0; i < beg; i++) ans.push_back(i); long long rem = k - (1LL << beg); for(long long i = beg - 1; i >= 0; i--) { if(rem & (1 << i)) { rem -= (1 << i); ans.push_back(beg++); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...