Good Subsets

All submissions for this problem are available.
Problem Description:
Devanshi is sitting with her team.She assigns a task to her teammates to evaluate their problem solving skills.She has given an array containing N elements as A={a1,a2,a3...aN}. She ask them to check whether there exists a good subset or not.
A good subset, say B is a subset which satisfies following statements:
1. B is a nonempty subset
2. There exists no integer x(x>1) which divides all elements of B.
3. There are no elements of B which are equal to another.
Input Format:
The first line of the input contains an integer T denoting the number of test cases.
The first line of each test case contains an integer N denoting the size of array.
Second line of each test case contains N integers a1,a2,... aN
Output Format:
Print YES if good subset exists; otherwise, print NO for each test case on a new line.
Constraints:
1<=T<=100 1<=N<=1000 1<=a[i]<=100000
Examples:
Input
2 3 1 2 3 2 2 4
Output:
YES NO
Explanation:
In the first test case,{1}{2}{3}{1,2}{2,3}{1,3}{1,2,3} are all the possible nonempty subsets, of which the first and the last four satisfies the given condition.
For the second test case, all possible subsets are {2}{4}{2,4}. For all of these subsets,x=2 divides each element. Therefore, no nonempty subset exists which satisfies the given condition.
Author:  nandishwar001 
Tags  nandishwar001 
Date Added:  14072018 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions