Editorial for Back From Summer '19 P1: Winnie's Orphans


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.

Author: Ninjaclasher

We can loop through each orphanage, keeping a running minimum of which orphanage has the least number of children with a cuteness value of 1 or 10. If the current orphanage has fewer such children than the running minimum, we update the best solution to the current orphanage's index. Otherwise, we move to the next orphanage.

Time Complexity: \mathcal O(NM)


Comments

There are no comments at the moment.