| 描述: |
Now that Andrew knows which Costco has the cheapest cookies, he has to get there - as quickly as possible!
He has given you 40 roads with the two endpoint locations and the distance of the road, and he starts at location 0 and the Costco is at location 20.
All roads are 2-way roads, meaning you can go from x to y and from y to x.
Please output the minimum distance needed to reach the Costco, and if there is no possible path, print -1. You will need to pass fifty tests to get the flag. And don't forget to be fast!
Sample Input:
0 20 18
4 8 2
0 4 8
4 20 6
Sample Output:
14 |