1378:Delete

时间限制:10 S   /  内存限制:262144 KB
AC:34   /  Submit:85
问题描述

Kim have an undirected complete graph with n vertices drawn on a paper. A complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge. One day he his naughty little brother came again and erased some vertices and edges.
Kim wants to know how many connected components are there now.
In graph theory, a connected component of an undirected graph is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the supergraph.

输入描述


输出描述

For each case, print a line contains the answer.

样例输入复制样例

2
4 2 1
2 4
3 4
1
10 10 3
5 6
5 7
5 8
5 9
5 10
4 6
4 7
4 8
4 9
4 10
1 2 3

样例输出

2
2

提示说明

The original graph in simple input 1 look like this:

and after delete:

so there are 2 connected components.

来源
2017年第八届福建省大学生程序设计竞赛热身赛

Copyright 2016 - 2024 XUJC ACM Team
闽ICP备2020022076号-1