Fatal Error · Extreme CodeFree
One Working Socket
The seaside fair has exactly one working socket. Every attraction needs power, and cables can branch anywhere along the way. Lay the cheapest set of cables that powers the whole fair.
Find the cheapest set of cables that powers every attraction.
Everything must be powered, and the cost must be the lowest possible.
N M K: spots, possible cables, needed spots. Line 2: the K needed spots, the socket first.M lines: u v w for cables 1 to M, joining spots u and v for cost w.N ≤ 120, 1 ≤ M ≤ 600, 2 ≤ K ≤ 10; every spot can be reachedw ≤ 1 000 000; any cheapest set of cables is accepted6 10 4 1 2 3 4 1 5 5 2 5 5 3 5 5 4 5 5 1 2 8 1 3 8 2 4 8 3 4 8 3 6 6 4 6 4
20 1 2 3 4
Sign in to play. It is free.
Sign in