PAC6 - Editorial

PROBLEM LINK:

Contest

Author: Chhekur

Tester: Pankaj Devesh

Editorialist: Pawan Kushwah

DIFFICULTY:

Easy

PREREQUISITES:

Graph, Dijkstra’s algorithm

PROBLEM:

You’re given a graph, you have to find out whether patient can be detained to the Hospital in given time or not.

EXPLANATION:

In order to solve this problem, first you have to make a matrix of given graph then you have to calculate the distance of each node from source, you can do it easy with Dijkstra’s algorithm, If time of sortest path is less then given time then answer is alive otherwise not.

Author’s solution can be found here.