F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Nux Walpurgis

Time Limit: 12000/8000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 339    Accepted Submission(s): 133


Problem Description
Given a weighted undirected graph, how many edges must be on the minimum spanning tree of this graph?
 

Input
The first line of the input is a integer $T$, meaning that there are $T$ test cases.

Every test cases begin with a integer $n$ ,which is the number of vertexes of this graph.

Then $n-1$ lines follow, the $i^{th}$ line contain $n-i$ integers, the $j^{th}$ number $w$ in this line represents the weight between vertex $i$ and vertex $i+j$.

$1 \leq T \leq 20.$

$1 \leq n , w\leq 3,000.$
 

Output
For every test case output the number of edges must be on the minimum spanning tree of this graph.
 

Sample Input
2 3 1 1 1 4 2 2 3 2 2 3
 

Sample Output
0 1
 

Hint
For the second sample, $(2 , 4)$ is satisfied.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 18:07:08, Gzip enabled