#P2269. [HNOI2002] 高质量的数据传输
[HNOI2002] 高质量的数据传输
Description
Original statement (image): 
To support various QoS requirements, modern networks consider parameters such as path delay, bandwidth, delay jitter, and loss rate when selecting routes. In a certain high-quality data transmission project, only two parameters are considered: network delay and loss rate.
The network can be represented by a simple undirected graph , where is the set of nodes in the network and is the set of links (edges) between pairs of nodes. According to the project requirements, each edge has two parameters: latency and loss rate.
- The latency on an edge is the time required for data to travel from one endpoint to the other. It is an integer measured in milliseconds, with .
- The loss rate of an edge is the percentage of data lost after transmission from one endpoint to the other, with .
Route selection on network is defined as follows: given two nodes and in , find a path between them.
For a path in , suppose the latencies and loss rates of the edges on the path are
$$t_1, t_2, t_3, \dots, t_{n-1}, \quad p_1, p_2, p_3, \dots, p_{n-1}.$$Then the total latency from to is
and the total loss rate is
High-quality data transmission requirement: if data is to be transmitted from a node to another node , then among all paths from to , the chosen path must have the minimal loss rate; subject to this, the latency must be minimal.
Given two nodes in the network graph, find a path that satisfies the high-quality data transmission requirement.
Input Format
There are lines.
-
Line : the number of nodes () and the indices of the two nodes to transmit data between (, ).
-
Lines to : the adjacency matrix of latencies . Each element (, , ) gives the latency of the edge from node to node . A value of indicates that there is no edge between and .
-
Lines to : the adjacency matrix of loss rates . Each element gives the loss rate of the edge from node to node (up to decimal places). A value of indicates that there is no edge between and .
It is guaranteed that if and only if .
It is guaranteed that , , and .
Output Format
Output line containing the latency and the loss rate of the chosen path. The latency is an integer and should be printed directly; the loss rate is a real number printed to decimal places.
3 1 3
0 1 5
1 0 2
5 2 0
0 0.1 0.05
0.1 0 0.05
0.05 0.05 0
5 0.0500
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号