Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: How Many Pairs?
Description You are given an undirected graph - Define
*max_len*(*p*) as the length of the edge with the maximum length of*p*where*p*is an arbitrary non-empty path in*G*. - Define
*min_pair*(*u*,*v*) as min{*max_len*(*p*) |*p*is a path connecting the vertices*u*and*v*.}. If there is no paths connecting*u*and*v*,*min_pair*(*u*,*v*) is defined as infinity.
Your task is to count the number of (unordered) pairs of vertices Input The first line of input contains three integer Output Output the answer to each query on a separate line. Sample Input 4 5 4 1 2 1 2 3 2 2 3 5 3 4 3 4 1 4 0 1 3 2 Sample Output 0 1 6 3 Source POJ Monthly--2006.05.28, zhucheng |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator