AtCoder Grand Contest 065
C
Avoid Half Sum
AtCoder
⌀ 2414
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given a sequence of non-negative integers $A=(A_1,A_2,\dots,A_N)$ of length $N$. Here, $S=\sum_{i=1}^{N} A_i$ is even.

翻译中…

Determine whether there is a pair of sequences of non-negative integers of length $N$, $B=(B_1,B_2,\dots,B_N)$ and $C=(C_1,C_2,\dots,C_N)$, that satisfy the following conditions:

翻译中…
  • $B_i+C_i=A_i$ for $i=1,2,\dots,N$.
  • $\sum_{i=1}^{N} X_i \neq \frac{S}{2}$ for every sequence of integers $X=(X_1,X_2,\dots,X_N)$ of length $N$ where $X_i=B_i$ or $X_i=C_i$ for $i=1,2,\dots,N$.
翻译中…

Solve $T$ test cases.

翻译中…

Constraints

翻译中…
  • $1 \leq T$
  • $1 \leq N \leq 2 \times 10^5$
  • $1 \leq A_i \leq 10^9$
  • $\sum_{i=1}^{N} A_i$ is even.
  • The sum of $N$ over all test cases in a single input is at most $2 \times 10^5$.
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\mathrm{case}_1
\vdots
\mathrm{case}_T

翻译中…

Each case is given in the following format:

翻译中…

N
A_1 A_2 \dots A_N

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain Yes if there is a pair of sequences $B$ and $C$ that satisfy the conditions for the $i$-th test case, and No otherwise.

翻译中…

样例

Input #1
3
3
1 2 3
6
1 1 2 2 3 3
4
1 1 1000000000 1000000000
Output #1
Yes
No
Yes
For the first test case, $B=(1,1,3)$ and $C=(0,1,0)$ satisfy the conditions. For the second test case, no pair of $B$ and $C$ satisfies the conditions.
题目信息
题号
agc065_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。