제출 #657333

#제출 시각아이디문제언어결과실행 시간메모리
657333couplefire순열 (APIO22_perm)C++17
100 / 100
2 ms340 KiB
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

vector<int> construct_permutation(ll k){
	if (k == 1ll) return {};
	if (k == 2ll) return {0};
	for (int p : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}) 
		if (k%p == 0ll && k > p) {
			vector<int> a = construct_permutation(p);
			vector<int> b = construct_permutation(k/p);
			for (auto& x : b)
				x += a.size();
			a.insert(a.end(), b.begin(), b.end());
			return a;
		}
	vector<int> res = construct_permutation(k >> 1ll);
	res.push_back(res.size());
	res.insert(res.begin(), res.size());
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...