제출 #884362

#제출 시각아이디문제언어결과실행 시간메모리
884362Sharky순열 (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...