Divide Students Into Classes Codechef Solution | CODE: NIUM CHALLENGE

Divide Students Into Classes Codechef Solution

You are given the heights of nn students who want to attend a school. The school, being weird as usual, has a condition that all the students in a class should have the same height. Also, the school runs only 12 classes from class 1 to class 12.

Find out whether it is possible for you to divide all the nn students into 12 classes. Note that in each class, there should be at least one student, and the heights of all the students should be equal. Multiple classes can have students with the same height also.

Input

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains an integer n.
The second line contains n space-separated integers h1,h2,…,hn denoting the heights of the students.

Output

For each test case, print a single line containing “yes” or “no” (without quotes) depending on the situation.

Constraints
1≤T≤10
1≤n≤105
1≤hi≤105
Subtasks
For 40% of the score: 1≤n,hi≤100
Remaining 60%: No extra constraints.
Sample Input
3
3
1 2 3
12
1 2 3 4 5 6 7 8 9 10 11 12
14
1 1 1 1 1 1 1 1 1 1 1 1 1 1

Sample Output

no
yes
yes

Explanation

Example case 1: There are only three students. So there is no way that there can be at least one student in each class.

Example case 2: There are only twelve students. Each student can go into a separate class.

Example case 3: There are total of fourteen students. One way of dividing them into classes will be class 1 to 10, one student each. While the 11th and 12th classes have two each.

Register in Contest or Click here

Divide Students Into Classes Codechef Solution>>

Alphabet Difference Codechef Solution>>

Queries in an Array Codechef Solution>>

Leave a Reply

error: Content is protected !!