UVa 10986 - Sending email

10986 - Sending email

 * http://acm.uva.es/p/v109/10986.html

Summary
Find length of the shortest path between two vertices in an undirected graph with non-negative edges' weights.

Explanation
Dijkstra's algorithm will do. You may need to use STL's priority_queue ot implement your own binary heap to make Dijkstra run in time.

Input
3 2 1 0 1 0 1 100 3 3 2 0 0 1 100 0 2 200 1 2 50 2 0 0 1

Output
Case #1: 100 Case #2: 150 Case #3: unreachable