CCF CSP data center (only)

© 2015-2019 Wang Liguang. All Rights Reserved. This article is a blogger original article, shall not be reproduced without the bloggers allowed in any form, otherwise it will pursue your legal responsibility. You are reading this article means that you have agreed to the Site statement (see top article)! This article is for reference only, please effectiveness of screening yourself, any problems, bloggers do not assume any responsibility!
This link: https://blog.csdn.net/happywlg123/article/details/99681290

topic

Questions Number: 201812-4
questions Name: Data Center
Time limit: 1.0s
memory limit: 512.0MB
Problem Description:
Here Insert Picture Description
Here Insert Picture Description

Sample input

4
5
1
1 2 3
1 3 4
1 4 5
2 3 8
3 4 2

Sample Output

4

Sample Description

Below is a sample description.
Here Insert Picture Description
Here Insert Picture Description

analysis

Although the subject that is very complicated, but after careful observation of the sample was found, in fact, a minimum spanning tree problem, do not even need to consider the root node in what position , because no matter what position, as long as the minimum spanning tree seeking out problems It is to meet the requirements of the subject.

Guess you like

Origin blog.csdn.net/happywlg123/article/details/99681290