CF1201B.Zero Array
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an array a1,a2,…,an .
In one operation you can choose two elements ai and aj ( i=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 n ( 2≤n≤105 ) — the size of the array.
The second line contains n integers a1,a2,…,an ( 1≤ai≤109 ) — 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 3 operations:
- Decrease a1 and a2 ,
- Decrease a3 and a4 ,
- Decrease a3 and a4
In the second example, one can show that it is impossible to make all elements equal to zero.