문제
Problem 2: Dueling GPS's [Brian Dean, 2014]
The map of the region in which FJ lives consists of N intersections
입력
* Line 1: The integers N and M.
Line i describes road i with four integers:
출력
* Line 1: The minimum total number of complaints FJ can receive if he routes himself from his house to the farm optimally.
예제1
5 7
3 4 7 1
1 3 2 20
1 4 17 18
4 5 25 3
1 2 10 1
3 5 4 14
2 4 6 5
1
Input Details
There are 5 intersections and 7 directional roads. The first road connects from intersection 3 to intersection 4; the first GPS thinks this road takes 7 units of time to traverse, and the second GPS thinks it takes 1 unit of time, etc.
Output Details
If FJ follows the path 1 -> 2 -> 4 -> 5, then the first GPS complains on the 1 -> 2 road (it would prefer the 1 -> 3 road instead). However, for the rest of the route 2 -> 4 -> 5, both GPSs are happy, since this is a shortest route from 2 to 5 according to each GPS.