CF1201B.Zero Array

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an array a1,a2,,ana_1, a_2, \ldots, a_n .

In one operation you can choose two elements aia_i and aja_j ( iji \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.

输入格式

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

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n ( 1ai1091 \le a_i \le 10^9 ) — the elements of the array.

输出格式

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

输入输出样例

  • 输入#1

    4
    1 1 2 2
    

    输出#1

    YES
  • 输入#2

    6
    1 2 3 4 5 6
    

    输出#2

    NO

说明/提示

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

  • Decrease a1a_1 and a2a_2 ,
  • Decrease a3a_3 and a4a_4 ,
  • Decrease a3a_3 and a4a_4

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

首页