PROBLEM LINK: G for Graph | CodeChef
Problem Code: G for Graph | CodeChef
Author: Codechef Adgitm Chapter : tannatsri | CodeChef User Profile for Tanishq Srivastava | CodeChef
Tester: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Editorialist: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
The Chef and his programmer friend are planning to go out on holidays. They have prepared a list of 4 places to visit.
With the help of google maps, Chef’s friend has written the distance between the places where they are going to visit. It is a list of length m where each row consists of the starting point, destination and the distance between the two places.
We can also interpret it as 2 denotes the starting point and 1 denotes the destination and 3 units is the distance between them.
There exists one direct path between every pair of city. Chef’s friend wants to check his programming skills. He tries to find such a path, so they have to travel a minimum distance to visit all the places and return back to the starting point. (They visit every place only once.)
using namespace std;
int m; cin>>m;
int onetotwo = 99999999;
int onetothree = 99999999;
int onetofour = 99999999;
int twotothree = 99999999;
int twotofour = 99999999;
int threetofour = 99999999;
int a,b,c; cin>>a>>b>>c;