제출 #876444

#제출 시각아이디문제언어결과실행 시간메모리
876444alexdd순열 (APIO22_perm)C++17
64.63 / 100
11 ms1628 KiB
#include<iostream> #include<vector> #include<algorithm> #include "perm.h" using namespace std; std::vector<int> construct_permutation(long long k) { vector<int> sol; long long nrs=1; int cnt=0; for(int i=1;i<60;i++) { if(((1LL<<i)&k)) { for(int j=cnt+i-1;j>=cnt;j--) sol.push_back(j); cnt += i; nrs += (1LL<<i)-1; } } for(int j=1;j<=k-nrs;j++) { sol.push_back(cnt); cnt++; } reverse(sol.begin(),sol.end()); return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...