codeforces#P1478C. Nezzar and Symmetric Array
Nezzar and Symmetric Array
Description
Long time ago there was a symmetric array consisting of distinct integers. Array is called symmetric if for each integer , there exists an integer such that .
For each integer , Nezzar wrote down an integer equal to the sum of absolute differences from to all integers in , i. e. .
Now a million years has passed and Nezzar can barely remember the array and totally forget . Nezzar wonders if there exists any symmetric array consisting of distinct integers that generates the array .
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, print "YES" in a single line if there exists a possible array . Otherwise, print "NO".
You can print letters in any case (upper or lower).
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, print "YES" in a single line if there exists a possible array . Otherwise, print "NO".
You can print letters in any case (upper or lower).
Samples
Note
In the first test case, is one possible symmetric array that generates the array .
In the second test case, it can be shown that there is no symmetric array consisting of distinct integers that can generate array .