Travel
The country frog lives in has nn towns which are conveniently numbered by 1,2,…,n1,2,…,n.
Among n(n−1)2n(n−1)2 pairs of towns, mm of them are connected by bidirectional highway, which needs aa minutes to travel. The other pairs are connected by railway, which needs bb minutes to travel.
Find the minimum time to travel from town 11 to town nn.
Input
The input consists of multiple tests. For each test:
The first line contains 44 integers n,m,a,bn,m,a,b (2≤n≤105,0≤m≤5⋅105,1≤a,b≤1092≤n≤105,0≤m≤5⋅105,1≤a,b≤109). Each of the following mmlines contains 22 integers ui,viui,vi, which denotes cities uiui and vivi are connected by highway. (1≤ui,vi≤n,ui≠vi1≤ui,vi≤n,ui≠vi).
Output
For each test, write 11 integer which denotes the minimum time.
Sample Input
3 2 1 31 22 33 2 2 31 22 3
Sample Output
23
题意:有n个城市,编号为1~n,每个城市都相互连通,其中有m对城市通过公路连通,其他的城市通过铁路连通,经过公路的时间为a,
经过铁路的时间为b,问从1到达n的时间最短为多少.
#include#include #include #include #include<string> #include #include