SP21049 UCF - Under Construction Forever

Description

UCF is now the nation’s second largest university in student population. To meet the demands

Input Format

The first input line contains a positive integer, n, indicating the number of restructurings to perform. Each restructuring will contain multiple lines. The first line contains two integers, b (1 number of connections between them. The next line contains b integers, wi (1 representing the cost of performing a reconstruction on the i-th selected building. The next c lines each contain two integers, xi and yi (1 Also, every pair of buildings will be directly or indirectly connected.

Output Format

For each restructuring, first output the heading “Case #d: ”, where d is the test case number, starting with 1. Then, print three integers separated by a single space: the minimum number of buildings left, the minimum cost for achieving this configuration, and the number of ways to achieve the minimum cost with minimum size. Follow the format illustrated in Sample Output.