Task DescriptionDiscussion (0)
Task :: z-birthday-party
As you already know, today is Z's birthday. So he decided to throw a party. During the party Z realized that his friends tend to hang-out in groups. More precisely, Z thinks that he can group his friends into group, so that all the friends from one group had not set at a table with any of the friends outside the group during the party.
Z has recorded all the table configurations during the party. More precisely, when some of his friends sit on a table, Z will record that. It would always happen that some of his friends sit at a table at the same time, and leave (go to dance) at the same time
Z gave you the list of all the table configuration, and asked you to find out how many "isolated" groups of friends are there (as described above)
INPUT:
From the standard input read a number n (1 <= n <= 10000), the number of table configurations. From each the next n lines read a number m (1 <= m <= 100) and m strings (up to 20 characters of english alphabet, without spaces), representing the names of the friends that set on the table. All Z's friends have different names.
From the standard input read a number n (1 <= n <= 10000), the number of table configurations. From each the next n lines read a number m (1 <= m <= 100) and m strings (up to 20 characters of english alphabet, without spaces), representing the names of the friends that set on the table. All Z's friends have different names.
OUTPUT:
To the standard output, print one integer representing the number of groups (as defined in the text) of Z's friends
To the standard output, print one integer representing the number of groups (as defined in the text) of Z's friends
Input:
Output:
4
2 aleks boba
2 boba dule
3 pitt angelina jordan
2 jordan divac
2 aleks boba
2 boba dule
3 pitt angelina jordan
2 jordan divac
Output:
2
Input:
3
3 aleks boba dule
3 pitt angelina divac
2 aleks angelina
3 aleks boba dule
3 pitt angelina divac
2 aleks angelina
1
Input:
3
3 aleks boba dule
3 pitt angelina divac
1 jordan
3 aleks boba dule
3 pitt angelina divac
1 jordan
3
Submit Solution
Available Languages
Task info
| Name: | z-birthday-party |
| Time: | 1 sec. |
| Memory: | 32 MB |
| #Tests: | 10 |
| AddedBy: | admin |
Task Ratings
| Difficulty: | 3.5 (12 votes) |
| Quality: | 4 (12 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| Al3kSaNdaR | 1.515 s. |
| crusader | 1.53 s. |
| Zeka_Dusman_1 | 1.85 s. |
| ivan100sic | 1.875 s. |
| _qwAker_ | 1.905 s. |
| demjan0001 | 1.965 s. |
| halil | 2.16 s. |
| msantl | 2.685 s. |
| OuyangJialin | 3.01 s. |
| nazggul | 3.28 s. |
Solved By
Home
Training
Competitions
Forum
FAQ