Editorial for DMOPC '14 Contest 1 P5 - Surprise Teleport

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.

Run BFS (Breadth-First Search) from the starting point to the Main Office ignoring the teleportation devices but storing the number of steps you walked when you intercepted the closest device. Output the distance to the office minus the distance to the closest teleportation device.


There are no comments at the moment.