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 as the least number of children with a cuteness value of 11 or 1010. If the current orphanage has less 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)\mathcal O(NM)


There are no comments at the moment.