eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Hacker`s Crackdown

Hacker`s Crackdown

Miracle Corporations has a number of system services running in a distributed computer system which is a prime target for hackers. The system is basically a set of \textbf{N} computer nodes with each of them running a set of \textbf{N} services. Note that, the set of services running on every node is same everywhere in the network. A hacker can destroy a service by running a specialized exploit for that service in all the nodes. One day, a smart hacker collects necessary exploits for all these \textbf{N} services and launches an attack on the system. He finds a security hole that gives him just enough time to run a single exploit in each computer. These exploits have the characteristic that, its successfully infects the computer where it was originally run and all the neighbor computers of that node. Given a network description, find the maximum number of services that the hacker can damage. \InputFile There will be multiple test cases in the input file. A test case begins with an integer \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{16}), the number of nodes in the network. The nodes are denoted by \textbf{0} to \textbf{N-1}. Each of the following \textbf{N} lines describes the neighbors of a node. Line \textbf{i} (\textbf{0} ≤ \textbf{i} < \textbf{N}) represents the description of node \textbf{i}. The description for node \textbf{i} starts with an integer \textbf{m} (Number of neighbors for node \textbf{i}), followed by \textbf{m} integers in the range of \textbf{0} to \textbf{N-1}, each denoting a neighboring node of node \textbf{i}. The end of input will be denoted by a case with \textbf{N = 0}. This case should not be processed. \OutputFile For each test case, print a line in the format, "\textbf{Case X: Y}", where \textbf{X} is the case number and \textbf{Y} is the maximum possible number of services that can be damaged.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
3
2 1 2
2 0 2
2 0 1
4
1 1
1 0
1 3
1 2
0
Выходные данные #1
Case 1: 3
Case 2: 2
Источник ACM-ICPC Thailand National Programming Contest 2010, Prince of Songkla University Phuket Campus 24 August 2010