Connected components Adjacency List
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Find the number of connected components in the graph given by adjacency list.
Input
The first line contains the number of vertices . Then lines are given. The -th line contains the description of all edges, outgoing from the -th vertex. Description starts with the number of outgoing edges. Then given the vertex numbers where the edges go. All vertices are numbered from to .
Output
Print the number of connected components.
Examples
Input #1
Answer #1
Submissions 905
Acceptance rate 53%