1003. Emergency (25)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected bysome roads. Amount of rescue teams in each city andthelengthof each road between any pair of cities are marked onthe map. When there is an emergency call to you fromsome other city, your job isto lead your men tothe place as quickly as possible, andatthe mean time, call up as many hands onthe way as possible.
Input
Each input filecontains one test case. For each test case, thefirst line contains4 positive integers: N (<= 500) - thenumberof cities (andthe cities are numbered from0to N-1), M - thenumberof roads, C1 and C2 - the cities that you are currently inandthat you must save, respectively. The next line contains N integers, wherethe i-th integeristhenumberof rescue teams inthe i-th city. Then M lines follow, each describes a road with three integers c1, c2 and L, which are the pair of cities connected by a road andthelengthofthat road, respectively. It is guaranteed that there exists at least one path from C1 to C2.
Output
For each test case, print in one line two numbers: thenumberof different shortest paths between C1 and C2, andthe maximum amount of rescue teams you can possibly gather.
All the numbers in a line must be separated by exactly one space, and there is no extra space allowed attheendof a line.
Sample Input
560212153011022031121241341
Sample Output
24
题目1003. Emergency (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAs an emergency rescue team leader of a city, you are given a special map of your country. The map shows severa