Help in the problem AMR14B

dijkastra
prims
wrong-answer

#1

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 : [https://www.codechef.com/problems/AMR14B](http://Problem Link)

Solution Link : Sol. Link

@vijju123 , @meooow , @aryanc403 please help.


#2

#3

First of all thanks for replying. I knew that there is an editorial. But I wanted to know that what is the error in my code and if possible can you provide me a testcase.