UVa 10099 - The Tourist Guide

10099 - The Tourist Guide Problem

Link: http://icpcres.ecs.baylor.edu/onlinejudge/external/100/10099.html

Summary

Explanation

Use Floyd Warshall O(N^3) All Pairs Shortest Path algorithm. =)

Gotchas

Input

7 10 1 2 30 1 3 15 1 4 10 2 4 25 2 5 60 3 4 40 3 6 20 4 7 35 5 7 20 6 7 30 1 7 99 0 0

Output

Scenario #1 Minimum Number of Trips = 5