Minimum Product

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 array1) 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 (10^{9}+7).
INPUT:
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
OUTPUT:
For each testcase, output single line indicating the answer to that testcase
CONSTRAINTS:
1<=T<=10
30 points : 1<=N<=2000, 1<=A[i]<=10^{6}
70 points : 1<=N<=20000, 1<=A[i]<=10^{8}
SAMPLE INPUT:
1
3
2 3 6
SAMPLE OUTPUT:
1
EXPLANATION:
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.
Author:  piyushkumar 
Tester:  balajiganapath 
Editorial  http://discuss.codechef.com/problems/MPROD 
Tags  easy, greedy, ltime11, piyushkumar 
Date Added:  20042014 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, 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, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 