All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.You are given a array A of N positive integers, and you can perform the following operation on the array
1) Pick any two indices i and j in the array
2) Divide A[i] and A[j] by some common factor of A[i] and A[j]
You can perform the above operation as many number of times as you want, and the aim is to minimize the product of the resulting array. Find this minimum product. Since the answer can be a large number, print the product modulo 1000000007 (109+7).
First line contains T, number of testcases. Each testcase contains 2 lines.
First line of each testcase contains single integer N, size of the array
Second line of each testcase contains N space separated integers, the array A
For each testcase, output single line indicating the answer to that testcase
30 points : 1<=N<=2000, 1<=A[i]<=106
70 points : 1<=N<=20000, 1<=A[i]<=108
2 3 6
First divide first and third numbers by 2, then the second and third by 3. This makes all numbers equal to 1, hence the product is 1.
|Tags||easy, greedy, ltime11, piyushkumar|
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.