제출 #584180

#제출 시각아이디문제언어결과실행 시간메모리
584180jairRS순열 (APIO22_perm)C++17
10 / 100
1096 ms620 KiB
#include "perm.h" using namespace std; std::vector<int> construct_permutation(long long k) { long long cur = 1; vector<int> res; for (int i = 0;; i++) { int exp = 0; int power2 = 1; while (cur + power2 * 2 <= k && (exp + 1) <= i) { power2 *= 2; exp++; } cur += power2; res.insert(res.begin() + exp, i); if (cur == k) break; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...