#C11552. Equalizing Array Elements

    ID: 40881 Type: Default 1000ms 256MiB

Equalizing Array Elements

Equalizing Array Elements

You are given Q test cases. In each test case, you are provided with an integer M and an array B of M positive integers. Your task is to determine whether it is possible to make all elements in the array equal using the allowed operations.

The answer is YES if all elements in the array are already equal and none of the elements equals 1; otherwise, the answer is NO. Note that if any element is 1, the answer is automatically NO.

Input/Output: The input is read from standard input and the output is written to standard output.

Examples:

Input:
3
3
3 3 3
5
2 4 6 8 10
4
5 1 5 1

Output: YES NO NO

</p>

inputFormat

The first line contains a single integer Q, the number of test cases. For each test case:

  • The first line contains an integer M, the number of elements in the array.
  • The second line contains M space-separated positive integers representing the array B.

outputFormat

For each test case, output a single line containing either YES if all elements can be made equal using the allowed operations (which in this problem means that the array is already equal and none of the elements is 1), or NO otherwise.

## sample
3
3
3 3 3
5
2 4 6 8 10
4
5 1 5 1
YES

NO NO

</p>