P18320 [CodeChef] COUNTP
普及-
题目描述

You are given an array $A = [A_{1}, A_{2}, \ldots, A_{N}]$.

Is it possible to partition A into two non-empty [subsequences] S_{1} and S_{2} such that $sum(S_{1}) \times sum(S_{2})$ is odd?

Here, sum(S_{1}) denotes the sum of elements in S_{1}, and sum(S_{2}) is defined similarly.

Note: S_{1} and S_{2} must partition A, that is:
S_{1} and S_{2} must be non-empty
Every element of A must be in either S_{1} or S_{2}
S_{1} and S_{2} must be disjoint (in terms of which indices their subsequences represent)

------ Input Format ------

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of 2 lines of input.
  • The first line of each test case contains a single integer N, the size of the array.
  • The next line contains $N space-separated integers A_{1}, A_{2}, \ldots, A_{N}$: the elements of the array.

------ Output Format ------

For each test case, print on a new line the answer: YES if the array can be partitioned into two subsequences satisfying the condition, and NO otherwise.

Each character of the output may be printed in either uppercase or lowercase, i.e, YES, yes, YEs, and yEs will all be treated as equivalent.

------ Constraints ------

$1 ≤ T ≤ 10^{5}$
$2 ≤ N ≤ 10^{5}$
$1 ≤ A_{i} ≤ 10^{9}$
- The sum of $N$ across all test cases won't exceed $10^{6}$.

----- Sample Input 1 ------
4
4
1 1 2 2
6
1 2 4 6 8 10
2
3 5
3
1 3 5
----- Sample Output 1 ------
YES
NO
YES
NO
----- explanation 1 ------
Test case $1$: We have $A = [\underline{1}, 1, \underline{2}, 2]$. Let $S_{1}$ be the underlined elements and $S_{2}$ be the other ones. $sum(S_{1}) \times sum(S_{2}) = 3\times 3 = 9$.

Test case $2$: It can be proved that no partition of $A$ into $S_{1}, S_{2}$ satisfies the condition.

Test case $4$: Choose $S_{1} = \{3\}, S_{2} = \{5\}$.

Test case $4$: It can be proved that no partition of $A$ into $S_{1}, S_{2}$ satisfies the condition.

输入格式

见题面

输出格式

见题面

样例输入
4 4 1 1 2 2 6 1 2 4 6 8 10 2 3 5 3 1 3 5
样例输出
YES NO YES NO