You are given a sequence of \(2N\) numbers. Check whether it is possible to divide this sequence into pairs such that the sum of numbers in pairs is equal to each other.
Input format
- The first line contains \( t\) denoting the number of test cases.
- The first line of each test contains the number of \(2N\) numbers (\(1 ≤ 2N ≤ 100000\)) in the sequence.
- Each of the lines contains \(2N\) integers from 1 to 109 denoting the elements of the sequence.
Output format
For each test case on a separate line, print YES if the input sequence can be divided into pairs such that the sums of these pairs are the same. Otherwise, print NO.
Constraints
\(1 ≤ t ≤ 10\)
\(1 ≤ 2N ≤ 100000\)
In test 1 answer is YES, because can divided on pairs(99,1) and (23,77).
In test answer is NO, because there is no way to divide so that the sums match.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor