Codeforces Round 641 (Div. 1)
A
Orac and LCM
Codeforces
1600
原题
←B →
翻译中…

For the multiset of positive integers $s=\{s_1,s_2,\dots,s_k\}$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $s$ as follow:

翻译中…
  • $\gcd(s)$ is the maximum positive integer $x$, such that all integers in $s$ are divisible on $x$.
  • $\textrm{lcm}(s)$ is the minimum positive integer $x$, that divisible on all integers from $s$.
翻译中…

For example, $\gcd(\{8,12\})=4,\gcd(\{12,18,6\})=6$ and $\textrm{lcm}(\{4,6\})=12$. Note that for any positive integer $x$, $\gcd(\{x\})=\textrm{lcm}(\{x\})=x$.

翻译中…

Orac has a sequence $a$ with length $n$. He come up with the multiset $t=\{\textrm{lcm}(\{a_i,a_j\})\ |\ i \lt j\}$, and asked you to find the value of $\gcd(t)$ for him. In other words, you need to calculate the GCD of LCMs of all pairs of elements in the given sequence.

翻译中…

Input

翻译中…

The first line contains one integer $n\ (2\le n\le 100\,000)$.

翻译中…

The second line contains $n$ integers, $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 200\,000$).

翻译中…

Output

翻译中…

Print one integer: $\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i \lt j\})$.

翻译中…

Note

翻译中…

For the first example, $t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$, so $\gcd(t)=1$.

翻译中…

For the second example, $t=\{120,40,80,120,240,80\}$, and it's not hard to see that $\gcd(t)=40$.

翻译中…

样例

Input #1
2
1 1
Output #1
1
InputCopy OutputCopy
Input #2
4
10 24 40 80
Output #2
40
InputCopy OutputCopy
Input #3
10
540 648 810 648 720 540 594 864 972 648
Output #3
54
InputCopy OutputCopy
题目信息
题号
1349A
时间限制
3 s
内存限制
256 MB
标签
数据结构
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。