You are given an array
In one move, Bob can pick two buckets with the same color and transform them into a bucket of any other color.
Now, Bob is also given an array
Note:
- 1-based indexing is followed.
Input format
- The first line contains an integer
denoting the number of test cases. - The first line of each test case contains an integer
. - The second line of each test case contains
space-separated integers denoting array . - The third line of each test case contains
space-separated integers denoting array .
Output format
For each test case, print 'Yes' if it is possible for Bob to get the required number of buckets for each color. Otherwise, print 'No'. Print the output in a new line.
Constraints
2 3 4 4 0 2 1 1 3 5 6 1 2 7 2
Yes No
For first test case:
- Choose two buckets of color 1, and transform it to a bucket of color 3.
- Now,
, thus Bob has required number of buckets for each color. - Thus, answer is 'Yes'.
For second test case:
- It can be proved that Bob can not have enough buckets of color to satisfy the conditions. Thus, answer is 'No'.
Please login to use the editor
You need to be logged in to access the code editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor