Constraints
The sum of
Input Specification
The first line contains a single integer
The first line of each test case contains a single integer
The second line of each test case contains
The third line of each test case contains
Output Specification
For each test case, output a single line containing YES
if it is possible to make all of the bins beautiful or NO
otherwise.
Sample Input
2
5
2 4 4 2 1
4 3 1 3 2
5
1 1 2 4 2
4 3 4 1 3
Sample Output
YES
NO
Explanation for Sample
For the first test case, one possible solution is as follows:
- Move one ball from bin
to bin and another from bin to bin . The number of balls in each bin is now . - Move one ball from bin
to bin and another from bin to bin . The number of balls in each bin is now . - Move one ball from bin
to bin and another from bin to bin . The number of balls in each bin is now .
For the second test case, it can be proven that it is impossible to make all of the bins beautiful.
Comments