Editorial for IOI '00 P4 - Walls
Submitting an official solution before solving the problem yourself is a bannable offence.
A straightforward solution can be based on the dual graph of the planar graph representing the map of towns and connecting walls. The dual graph is obtained by viewing the areas as nodes that are connected when they share a wall (this can be a multigraph).
Traversing an edge in the dual graph corresponds to crossing a wall, hence minimizing wall crossings corresponds to selecting shortest paths in the dual graph.
A brute force approach tries each area (factor
Comments