![]() | ||||
Online Judge | Problem Set | Authors | Online Contests | User |
---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
How Many Pairs?
Description You are given an undirected graph G with N vertices and M edges. Each edge has a length. Below are two definitions. Your task is to count the number of (unordered) pairs of vertices u and v satisfying the condition that min_pair(u, v) is not greater than a given integer A. Input The first line of input contains three integer N, M and Q (1 < N ¡Ü 10,000, 0 < M ¡Ü 50,000, 0 < Q ¡Ü 10,000). N is the number of vertices, M is the number of edges and Q is the number of queries. Each of the next M lines contains three integers a, b, and c (1 ¡Ü a, b ¡Ü N, 0 ¡Ü c < 108) describing an edge connecting the vertices a and b with length c. Each of the following Q lines gives a query consisting of a single integer A (0 ¡Ü A < 108). Output Output the answer to each query on a separate line. Sample Input Sample Output Source |
[Submit] [Go Back] [Status] [Discuss]
All Copyright Reserved 2003-2005 Ying Fuchen,Xu Pengcheng
Any problem, Please Contact Administrator