제출 #597597

#제출 시각아이디문제언어결과실행 시간메모리
597597boris_mihov순열 (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h" #include <iostream> typedef long long llong; int unused = 120; std::vector < int > ans; std::vector < int > construct_permutation(llong k) { ans.clear(); unused = 120; bool flag = false; for (int bit = 59 ; bit >= 0 ; --bit) { if ((k & (1LL << bit)) == 0) continue; if (!flag) { flag = 1; for (int i = unused - bit + 1 ; i <= unused ; ++i) { ans.push_back(i); } unused -= bit; continue; } ans.insert(ans.begin() + (int)(ans.size() - bit), unused--); } for (int &i : ans) i -= unused + 1; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...