#P3171. [CQOI2015] 网络吞吐量
[CQOI2015] 网络吞吐量
Description
Now, given the connectivity between routers in a computer network and the maximum throughput of each router (i.e., the number of packets it can forward per second), with routers numbered from to , assume all packets are forwarded strictly along shortest paths. Compute the maximum throughput from router to router . Ignore the time overhead of forwarding and transmission, and do not consider link bandwidth limits, i.e., assume packets can traverse the network instantaneously. Routers and serve as the source and destination, and their own throughputs are not considered. There is also no link that directly connects and .
Input Format
The first line contains two integers separated by a space, representing the number of routers and the number of links .
Lines to each contain three integers , indicating there is an undirected link connecting routers and with distance .
Lines to each contain one integer. The integer on line represents the throughput of router .
Output Format
Output a single line containing one integer, representing the maximum throughput of the network.
7 10
1 2 2
1 5 2
2 4 1
2 3 3
3 7 1
4 5 4
4 3 1
4 6 1
5 6 2
6 7 1
1
100
20
50
20
60
1
70
Hint
Constraints
For of the testdata, it is guaranteed that , , and .
Translated by ChatGPT 5
京公网安备 11011102002149号