#10278 - Fire Station

Solved By:wesley
Theory Difficulty:medium
Coding Difficulty:medium
Algorithms Used:brute force
dijkstra
Solution Description: First, run Dijkstra with all of the fire stations as sources. That is, put every fire station intersection into the queue with distance 0 and run Dijkstra with all of them at once.

Now, we'll try to place a new fire station at each vertex. For each vertex, run Dijkstra with that vertex as the source. Use the distance array we got from the first step though, so that the algorithm will terminate when no more improvements can be made.

After each of these Dijkstra runs, determine the maximum distance from a fire station for each house. Keep track of the best one and output it at the end.






Copyright 2008 (c) QuestToSolve.Com - Graphs Powered By PHPGraphLib - Click For Official Site