제출 #911871

#제출 시각아이디문제언어결과실행 시간메모리
911871nullchilly순열 (APIO22_perm)C++17
91.33 / 100
2 ms600 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { int m = __lg(k) + 1; vector<int> zero(m + 1); int pad = 0; for (int j = 0; j <= m; j++) { if (k & (1ll << j)) { zero[m - j - 1] = ++pad; } } vector<int> ans; for (int i = 1; i < m; i++) { ans.push_back(i + pad - 2); if (zero[i]) ans.push_back(zero[i] - 1); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...