CF1472B.Fair Division

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Fair Division

Alice and Bob received nn candies from their parents. Each candy weighs either 1 gram or 2 grams. Now they want to divide all candies among themselves fairly so that the total weight of Alice's candies is equal to the total weight of Bob's candies.

Check if they can do that.

Note that candies are not allowed to be cut in half.

Input

The first line contains one integer tt (1t1041 \le t \le 10^4) — the number of test cases. Then tt test cases follow.

The first line of each test case contains an integer nn (1n1001 \le n \le 100) — the number of candies that Alice and Bob received.

The next line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n — the weights of the candies. The weight of each candy is either 11 or 22.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

Output

For each test case, output on a separate line:

  • "YES", if all candies can be divided into two sets with the same weight;
  • "NO" otherwise.

You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).

Note

In the first test case, Alice and Bob can each take one candy, then both will have a total weight of 11.

In the second test case, any division will be unfair.

In the third test case, both Alice and Bob can take two candies, one of weight 11 and one of weight 22.

In the fourth test case, it is impossible to divide three identical candies between two people.

In the fifth test case, any division will also be unfair.

Samples

5
2
1 1
2
1 2
4
1 2 1 2
3
2 2 2
3
2 1 2
YES
NO
YES
NO
NO

在线编程 IDE

建议全屏模式获得最佳体验