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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.