atcoder#AGC010A. [AGC010A] Addition
[AGC010A] Addition
Score : points
Problem Statement
There are integers written on a blackboard. The -th integer is .
Takahashi will repeatedly perform the following operation on these numbers:
- Select a pair of integers, and , that have the same parity (that is, both are even or both are odd) and erase them.
- Then, write a new integer on the blackboard that is equal to the sum of those integers, .
Determine whether it is possible to have only one integer on the blackboard.
Constraints
- is an integer.
Input
The input is given from Standard Input in the following format:
…
Output
If it is possible to have only one integer on the blackboard, print YES
. Otherwise, print NO
.
3
1 2 3
YES
It is possible to have only one integer on the blackboard, as follows:
- Erase and from the blackboard, then write . Now, there are two integers on the blackboard: and .
- Erase and from the blackboard, then write . Now, there is only one integer on the blackboard: .
5
1 2 3 4 5
NO