Submission #884362

#TimeUsernameProblemLanguageResultExecution timeMemory
884362SharkyPermutation (APIO22_perm)C++17
91.33 / 100
2 ms436 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; using ll = long long; std::vector<int> construct_permutation(long long k) { vector<int> ops, perm; while (k > 1) { if (k & 1) { k--; ops.push_back(1); } else { k /= 2; ops.push_back(0); } } reverse(ops.begin(), ops.end()); int cur = 0; for (auto& x : ops) { if (x == 0) { perm.push_back(cur++); } else perm.insert(perm.begin(), cur++); } return perm; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...