Editorial for Mock CCC '19 Contest 2 S2 - Tudor Puts A Goat On A Rope


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.

Imagine shifting the rectangle either horizontally or vertically, but not both simultaneously. If the point can touch the rectangle after some shift, then the distance can be computed explicitly.

Otherwise, the point is closest to a corner, and all of them can be checked for the minimal distance.


Comments

There are no comments at the moment.