Editorial for COCI '22 Contest 3 #1 Estimathon
Submitting an official solution before solving the problem yourself is a bannable offence.
First, if , the answer is NE
. Why? Because for each table we need to use chairs of the same colour.
Therefore, we can use different chair colours at most. Domagoj wants us to use every chair colour. If ,
that is impossible.
If we have less than 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 , we can fill (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 , the answer is NE
; otherwise,
the answer is DA
.
Comments