Editorial for COCI '22 Contest 3 #1 Estimathon


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

First, if n < m, the answer is NE. Why? Because for each table we need to use chairs of the same colour. Therefore, we can use n different chair colours at most. Domagoj wants us to use every chair colour. If n < m, that is impossible.

If we have less than 4 chairs of the same colour, the answer is also NE. Why? Let us look at these two cases: We do not use that colour (Domagoj is sad), we pair these chairs with chairs of some other colour (Paula is sad), and we want to make them both happy :).

Third and final check: can we fill all the tables with chairs? For some colour i, we can fill \frac{a_i}{4} (rounded down to the nearest integer) tables. If we sum up the values for each colour, we will get the maximum number of tables we can fill with chairs. Now, if that number is smaller than n, the answer is NE; otherwise, the answer is DA.


Comments

There are no comments at the moment.