- ← Back
- A
- B
- C
- D
- F
- Масиви1
- А обласна олімпіада 2024
- Проста
- В обласна 2024(масив!)
- А ОТГ 2023
- А обласна олімпіада 2023
- K
- L
- Е (sum)
- G(sum)
- Н(sum)
- І (кількість)
- J(Кількість)
- N(Кількість)
- А 2023 (проста)
- А 2017 (Стрічки)
- А 2018 (Стрічки)
- А 2012(Стрічки)
- Стрічки
- В 2022(Стрічки)
- Масив стрічок
- В 2023 Стрічки
- С 2023 ОТГ (масив стрічок)
- А 2021 проста
- B 2021
- В ОТГ 2023
- D 2023
- умови
- проста
- 2024 ОТГ В
- Масив стрічок
- Стрічки
- Множини D2024
- формули F 2023
- формули С 2024 ОТГ
- Формули 2023С
- Масиви C 2024
- Макс ІІ
- район2024
- область 25 а
- обл 25b
- Scoreboard
Piggy Bank
Limits: 2 sec., 256 MiB
Kerem and Asli have just broken their piggy bank. Now they have \(N\) coins, each of which is either 1-lira or 2-lira coins. Don’t ask where they got 2-lira coins from, that’s a secret.
Can you tell if it’s possible to divide the coins between Kerem and Asli so that they receive an equal total amount?
Input
The first line contains a single integer number \(N\) — the number of coins. The next line contains \(N\) integer numbers — the values of coins they have. Each of the numbers is either 1 or 2, representing 1-lira and 2-lira coins, respectively.
Output
Output string YES if it’s possible to divide the coins
properly, and NO otherwise.
Constraints
\(1 \le N \le 100000\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 7 2 2 2 1 1 1 1 | YES |
| Input (stdin) | Output (stdout) |
|---|---|
| 4 2 1 1 1 | NO |
Notes
One of possible divisions for the first sample is \((2, 2, 1)\) and \((2, 1, 1, 1)\).
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|