Problem AH
All Friends
Sociologists are interested in the phenomenon of
“friendship”. To study this property, they analyze various
groups of people. For each two persons in such a group they
determine whether they are friends (it is assumed that this
relation is symmetric). The sociologists are mostly interested
in the sets of friends. A set
Your task is to determine the number of maximal sets of
friends in each group. In case this number exceeds
Input
The input consists of several instances, separated by single empty lines.
The first line of each instance consists of two integers
Output
The output for each instance consists of a single line
containing the number of maximal sets of friends in the
described group, or the string “Too many
maximal sets of friends.” (including the period!) in case
this number is greater than
Sample Input 1 | Sample Output 1 |
---|---|
5 4 1 2 3 4 2 3 4 5 |
4 |