Skip to content

A modified Dijkstra's algorithm to be used in solving path problems

Notifications You must be signed in to change notification settings

nurdidemm/Dijkstra-Algorithm-Implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Dijkstra-Algorithm-Implementation

Input Format

The first line contains two numbers n, m: The number of crossroads and the number of roads connecting them.

Some paths have reservoirs.

The next m lines contains three numbers a b c: a road from a to b with c indicating it has the a reservoir of the Ents draught if c is 1 and a parched road if c is 2.


Output Format

Prints the minimum number of parched roads needed to pass through to get to a point. If there is no path with at least one road with a reservoir print "-1".

Assume that they start from vertex number 1 and need to reach vertex number n.

About

A modified Dijkstra's algorithm to be used in solving path problems

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages