how to do with mst?
https://www.hackerearth.com/practice/algorithms/graphs/minimum-spanning-tree/practice-problems/algorithm/travelling-tom-7eadedb7/description/
my code:https://ideone.com/jlQljY
CodeChef Starters 132 Solution Discussion
Codeforces Round 943 Solution Discussion