Elements of the sequence
Practice
5 (2 votes)
Basic programming
Basic math
Math
Implementation
Basics of implementation
Basics of input/output
Problem
91% Success 434 Attempts 10 Points 1s Time Limit 256MB Memory 1024 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\)

 

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...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
4 votes
Tags:
Very-Easy
Points:10
5 votes
Tags:
Math BasicAlgorithmsBasic MathMath
Points:10
1 votes
Tags:
Very-Easy