#GL0000103. Phân phối thừa số để tối đa ƯCLN (Iks)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Phân phối thừa số để tối đa ƯCLN (Iks)
Iks
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
Given a sequence of positive integers, one operation selects two distinct positions and a prime dividing the first element. Divide that element by and multiply the other by . Repeat any number of operations. The sequence score is its GCD. Find the maximum possible score and the minimum number of operations needed to reach that score.
Input
The first line contains . The second line contains positive integers .
Output
Print two integers: the maximum achievable GCD and the minimum number of operations to reach it.
Subtasks
- Subtask 1 (20 points): , .
- Subtask 2 (30 points): , .
- Subtask 3 (50 points): , .
Examples
Input
3
4 4 1
Output
2 1
Explanation
The total exponent of prime is , so each of three numbers can receive at least one factor ; the maximum GCD is . Move one factor from a to the , producing in one operation.