Codeforces Round 577 (Div. 2)
B
Zero Array
Codeforces
1500
原题
← AC →
翻译中…

You are given an array $a_1, a_2, \ldots, a_n$.

翻译中…

In one operation you can choose two elements $a_i$ and $a_j$ ($i \ne j$) and decrease each of them by one.

翻译中…

You need to check whether it is possible to make all the elements equal to zero or not.

翻译中…

Input

翻译中…

The first line contains a single integer $n$ ($2 \le n \le 10^5$) — the size of the array.

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the elements of the array.

翻译中…

Output

翻译中…

Print "YES" if it is possible to make all elements zero, otherwise print "NO".

翻译中…

Note

翻译中…

In the first example, you can make all elements equal to zero in $3$ operations:

翻译中…
  • Decrease $a_1$ and $a_2$,
  • Decrease $a_3$ and $a_4$,
  • Decrease $a_3$ and $a_4$
翻译中…

In the second example, one can show that it is impossible to make all elements equal to zero.

翻译中…

样例

Input #1
4
1 1 2 2
Output #1
YES
InputCopy OutputCopy
Input #2
6
1 2 3 4 5 6
Output #2
NO
InputCopy OutputCopy
题目信息
题号
1201B
时间限制
1 s
内存限制
256 MB
标签
贪心
数学

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