Editorial for New Year's '18 P3 - World Domination Fun
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
For the first subtask, it is enough to keep track of the snowmen with the smallest height. If Bob can pick a subarray of length
Time Complexity:
For the next subtask, sort the snowmen by their heights. Then calculate how much snow is necessary to bring all the shorter snowmen to the same height as the
Time Complexity:
For the final subtask, we binary search for the largest possible strength. Given a certain strength, we can determine the minimum amount of snow necessary to achieve this strength using the following idea:
Loop through the snowmen from left to right. If a snowman shorter than the strength is encountered, increase that snowman's height to the certain strength. At this point, there is a choice. There are many subarrays of length
Time Complexity:
Comments