Elements of the sequence
91% Success434 Attempts10 Points1s Time Limit256MB Memory1024 KB Max Code
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\)
Examples
Input
2 2 99 23 77 1 3 1 10101 2 3 4 5
Output
YES NO
Explanation
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
Loading Editor...
Results