Editorial for MALD Contest 1 P3 - Scratch Cat and Infestation
Submitting an official solution before solving the problem yourself is a bannable offence.
Simulating all days is too slow because there's a maximum of
We can cut down the days to simulate if we skip to the day when there are
Sort the natural infection times in ascending order. The
While simulating, it is always optimal for Yubocats to manually infect cats naturally infected latest. If one cat is naturally infected tomorrow and another in a million days, it is always optimal to infect the latter cat. Keep in mind that manually infected cats become Yubocats the next day. You can simplify your implementation by using a pending variable to store the number of cats that will become a Yubocat the next day.
Complexity:
Comments