307383: CF1349A. Orac and LCM
Memory Limit:256 MB
Time Limit:3 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Orac and LCM
题意翻译
- 给定长度为 $n$ 的序列 $a_1,a_2,a_3,\ldots,a_n$。 - 设可重集 $S=\{\mathrm{lcm}(a_i,a_j)|1 \leq i<j\leq n\}$。 - 设一个集合的最大公约数为最大的正整数 $d$,满足集合内任意一个元素 $x$ 均有 $d|x$。 - 请你求出 $\gcd(S)$。 - $1 \leq n \leq 10^5$,$1 \leq a_i \leq 2 \times 10^5$。题目描述
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<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.输入输出格式
输入格式
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 $ ).
输出格式
Print one integer: $ \gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i<j\}) $ .
输入输出样例
输入样例 #1
2
1 1
输出样例 #1
1
输入样例 #2
4
10 24 40 80
输出样例 #2
40
输入样例 #3
10
540 648 810 648 720 540 594 864 972 648
输出样例 #3
54