Editorial for COCI '15 Contest 7 #2 Prozor
Submitting an official solution before solving the problem yourself is a bannable offence.
The limitations from the task allow us to evaluate every possible shot. In other words, we can assume for each pixel that it is the one located in the upper left corner of the racket and then count how many flies would be affected by that shot. When done with this procedure for each pixel, we know the position of the upper left pixel of the optimal shot, and that is sufficient in order to reconstruct the image and score all points for this task. Additionally, we need to make sure that the racket is located entirely within the image and that we won't affect the flies located on the edges of the racket.
The time complexity of the aforementioned procedure is . Moreover, we encourage you to come up with a solution for this task given the limitation .
Comments