Note: This is an approximate problem. There is no exact solution. You must find the most optimal solution. Please, take a look at the sample explanation to ensure that you understand the problem correctly.
Problem statement
Given a connected network G with N Railway Stations and M Railway Tracks. Each track connects two different Railway Stations and has a cost C associated with it.
We have a set S consisting of Railway Stations in G. |S| = K .
We need to find a network T, which is a subnetwork of G and has all stations present in set S. (It is possible that T has some stations not present in S). In T , there must exists a unique path between any two stations.
We need to select T such that (Z = Sum of costs of Tracks present in T) is minimized.
Input format :
Output format :
Verdict and scoring :
Your score is equal to the sum of the values of all test files. The value of each test file is equal to the value of Z that you found.
If T is invalid or T does not has all stations present in S then you will recieve a Wrong Answer Verdict.
Constraints :
Edge Number : 4, 6. Covers all the vertices {2 , 3 , 5}
Z = 54 + 15 = 69
{Note: This is just a Sample Test, Test cases follow Input Constraints Mentioned}