제출 #980399

#제출 시각아이디문제언어결과실행 시간메모리
980399willychan순열 (APIO22_perm)C++17
10 / 100
109 ms262144 KiB
#include "perm.h" using namespace std; std::vector<int> construct_permutation(long long k) { vector<int> s; int sum = 0; k--; for(int f=18;f>=2;f--){ if((1LL<<f)-1<=k){ s.push_back(f); k-=((1<<f)-1); sum+=f; } } sum+=k; for(int i=0;i<k;i++) s.push_back(1); vector<int> ans; for(auto l : s){ for(int i=sum-l+1;i<=sum;i++) ans.push_back(i-1); sum-=l; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...