Elements of the sequence

5

2 votes
Basic Programming, , Basic Math, Math, Implementation, Basics of Implementation, Basics of Input/Output
Problem

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 (12N100000) 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

1t10

12N100000

 

Time Limit: 1
Memory Limit: 256
Source Limit:
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.

Editor Image

?