eolymp
bolt
Try our new interface for solving problems
Məsələlər

Route Redundancy

Route Redundancy

A city is made up exclusively of one-way streets. Each street in the city has a capacity, which is the minimum of the capacities of the streets along that route. The \textit{redundancy ratio} from point \textbf{A} to point \textbf{B} is the ratio of the maximum number of cars that can get from point \textbf{A} to point \textbf{B} in an hour using all routes simultaneously, to the maximum number of cars that can get from point \textbf{A} to point \textbf{B} in an hour using one route. The minimum redundancy ratio is the number of capacity of the single route with the largest capacity. \InputFile The first line of input contains asingle integer \textbf{P} (\textbf{1} ≤ \textbf{P} ≤ \textbf{1000}), which is the number of data sets that follow.Each data set consists of several lines and represents a directed graph with positive integer weights. The first line of each data set contains five apace separatde integers. The first integer \textbf{D} is the data set number. The second integer,N(2<=N<=1000),is the number of nodes inthe graph. The thied integer \textbf{E} (\textbf{E} ≥ \textbf{1}) is the number of edges in the graph. The fourth integer \textbf{A} (\textbf{0} ≤ \textbf{A }< \textbf{N}) is the index of point \textbf{A}. The fifth integer \textbf{B} (\textbf{0} ≤ \textbf{B} < \textbf{N}, \textbf{A} ≠ \textbf{B}) is the index of point \textbf{B}. The remaining \textbf{E} lines desceibe each edge. Each line contains three space separated in tegers. The first integer \textbf{U} (\textbf{0} ≤ \textbf{U} < \textbf{N}) is the index of node U. The second integer \textbf{V} (\textbf{0} ≤ \textbf{V} < \textbf{N}, \textbf{V} ≠ \textbf{U}) is the node \textbf{V}. The third integer \textbf{W} (\textbf{1} ≤ \textbf{W} ≤ \textbf{1000}) is th capacity (weight) of path from \textbf{U} to \textbf{V}. \OutputFile For each data set there is one line of output. It contains the date set number(N) follow by a single space, followed by a floating-point value which is the minimum redundancy ratio to \textbf{3} digits after the decimal point.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
1
2 7 11 0 6
0 1 3
0 3 3
1 2 4
2 0 3
2 3 1
2 4 2
3 4 2
3 5 6
4 1 1
4 6 1
5 6 9
Çıxış verilənləri #1
1 1.667
Mənbə 2011 Greater New York Regional