#P9235. [蓝桥杯 2023 省 A] 网络稳定性
[蓝桥杯 2023 省 A] 网络稳定性
Problem Description
There is a local area network consisting of devices and physical connections. The stability of the -th connection is .
For a path from device to device that passes through several physical connections, we define the stability of this path as the minimum stability among all connections on the path.
We define the communication stability between device and device as the maximum stability among all feasible paths from to .
Given the physical connection information in the LAN, compute the communication stability for several pairs of devices and . If there is no path between two devices, output .
Input Format
The first line contains three integers , representing the number of devices, the number of physical connections, and the number of queries.
The next lines each contain three integers , meaning there is a physical connection between and with stability .
The next lines each contain two integers , asking for the communication stability between and .
Output Format
Output lines. Each line contains one integer, in order, representing the answer to each query.
5 4 3
1 2 5
2 3 6
3 4 1
1 4 3
1 5
2 4
1 3
-1
3
5
Hint
[Scale and constraints of testdata]
For of the testdata, , .
For of the testdata, , .
For all testdata, , , , , , .
Translated by ChatGPT 5