Editorial for COCI '12 Contest 5 #4 Hipercijevi
Submitting an official solution before solving the problem yourself is a bannable offence.
The graph described in the problem statement is a hypergraph. When solving the shortest path problem on a hypergraph, we can convert it to a "normal" undirected graph by simply connecting all pairs of nodes (stations) on the same hyperedge (hypertube) with undirected edges. This results in a graph with a total of
However, the constraints prevent such a solution from obtaining all points. The most elegant way to speed up the solution is adding a new node for each hypertube, connecting it with undirected edges to all stations connected to the corresponding hypertube. Such a graph has
Comments