#P9756. [COCI 2022/2023 #3] Estimathon
[COCI 2022/2023 #3] Estimathon
Background
Paula and Domagoj are about to organize an exciting team competition called Estimathon. They have already prepared the problems, and are now arranging the room for it.
Problem Description
In the blink of an eye, Domagoj has placed tables in the room. Now they need to add chairs. They have chairs of various colors. There are colors in total, and the number of chairs of the -th color is . Each team consists of four people. Therefore, for each table, Paula and Domagoj need to add chairs. They want to arrange the room as nicely as possible. To do so, they set the following requirements:
- The chairs at each table must all be the same color.
- Each color of chairs must be used by at least one table.
Because they care too much about the room being perfect, they suddenly realize that the contest has already begun. Please help them determine whether there exists a possible arrangement.
Input Format
The first line contains two integers , representing the number of tables and the number of chair colors.
The second line contains integers , where the -th number represents the number of chairs of the -th color.
Output Format
Output one string in a single line.
If there exists an arrangement that satisfies the requirements, output DA;
otherwise output NE.
7 3
5 21 9
DA
5 4
8 5 10 3
NE
6 5
5 5 5 5 5
NE
Hint
Sample Explanation #2.
We can make tables each with chairs of the same color, but we cannot make any table use the fourth color, so the second requirement cannot be satisfied.
Constraints.
| Points | Special Properties | |
|---|---|---|
| No special restrictions |
For of the testdata, and .
This problem is worth points.
Translated by ChatGPT 5