제출 #745267

#제출 시각아이디문제언어결과실행 시간메모리
745267speedyArda순열 (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h" #include "bits/stdc++.h" using namespace std; vector<int> construct_permutation(long long k) { long long beg = __lg(k); vector<int> ans; for(int i = 0; i < beg; i++) ans.push_back(i); long long rem = k - (1LL << beg); for(long long i = beg - 1; i >= 0; i--) { if(rem & (1LL << i)) { rem -= (1LL << i); ans.insert(ans.begin() + i, beg++); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...