|
|||
Smart CityImagine a smart city where (1) only self-driving cars are used, (2) all streets are bidirectional, cars pass each of them in one time unit, and, consequently, the road network of the city can properly be modelled by a connected, unweighted, undirected graph. Given such a graph (n: number of nodes; m: number of edges; nodes are denoted by 1, 2, …, n), for each pair of nodes A and B, we imagine having one unit of “flow” along the edges from A to B. More precisely, the flow between A and B divides itself evenly along all the possible shortest paths from A to B: so if there are k shortest paths from A to B, then 1/k units of flow pass along each one. We define the traffic of an edge to be the total amount of flow it carries, counting flow between all pairs of nodes using this edge. We are interested in the most vital edge of the graph, the one that carries the highest volume of traffic along shortest paths. Input SpecificationThe first line of the input contains the number of test cases. For each test case, the first line contains two integers, the values of n and m (separated by a single space). The next m lines contain the endpoints of the edges (separated by a single space). Input Limits and Constraints
Output SpecificationFor each test case, print one line with three integers separated by a single space: the highest traffic value and the endpoints of the corresponding edge. If there are multiple edges with maximal traffic value, then print the first one in lexicographical order. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |