|
Лимит времени 1000/1000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Problem description
Calculate number of connected components in undirected graph.
Input
There is a single integer on the first line of input N (1 <= N <= 100), then N lines with N integers 0 or 1 (adjacency matrix of graph).
Output
Write number of connected components.
Example
| stdin |
stdout |
6
0
1 1 0 0 0
1 0 1 0 0 0
1 1 0 0 0 0
0 0 0 0 1 0
0 0 0 1 0 0
0 0 0 0 0 0 |
3 |
Для отправки решений необходимо выполнить вход.
|