Robin, of course. And as written above, using "dynamic programming," i.e., to remember and to use already calculated the options and sub-options.

\r

In real life, these tasks we try to solve the zonal method. And for Moscow and probably St. Petersburg in the form of sectors around the metro. To the sector for movement. Sectors can slightly overlap each other. Then the lemmings to select a route based on the preference to be in the same sector or max related. Well, the number of points taken into account. You can continue to take into account their remoteness and the sequence of bypass ask.

\r

Just solve by brute force on the full map is to build a metro line, ground transport, consider the water hazard, the fucking railroad tracks, tube, and costs harder to calculate. You end up with one carrier, 50% will use, and the other at 150%.