I have been working on the problem for some time. The solution I thought was to calculate mst of the given graph and calculate the cost. Then apply dijkshtra on it and calculate the minimum cost for each vertex from 0. And check if they are same or not considering the edges cases(such as graph is not connected). Any help would be appreciated.
Problem Link : [AMR14B Problem - CodeChef](http://Problem Link)
Solution Link : Sol. Link
@vijju123 , @meooow , @aryanc403 please help.