제출 #738997

#제출 시각아이디문제언어결과실행 시간메모리
738997Prieved1순열 (APIO22_perm)C++17
100 / 100
2 ms340 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { if(k==1)return {}; if(k==2)return {0}; int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; vector<int> res; for(int i:primes) { if(k%i==0 and k>i) { vector<int> l=construct_permutation(k/i), r=construct_permutation(i); for(int &j:r) { j+=l.size(); } for(int j:r)l.push_back(j); return l; } } vector<int> c=construct_permutation(k/2); c.push_back(c.size()); c.insert(c.begin(),c.size()); return c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...