Submission #954941

#TimeUsernameProblemLanguageResultExecution timeMemory
954941horiseunPermutation (APIO22_perm)C++17
91.33 / 100
2 ms348 KiB
#include <iostream> #include <vector> #include <numeric> #include <algorithm> #include "perm.h" using namespace std; #define ll long long vector<int> construct_permutation(ll k) { int curr = 0; for (int i = 59; i >= 0; i--) { if (k & (1ll << i)) { curr = i; break; } } vector<int> ret(curr); iota(ret.begin(), ret.end(), 0); for (int i = curr - 1; i >= 0; i--) { if (k & (1ll << i)) { ret.insert(ret.begin() + i, curr); curr++; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...