Alien Attack 2
InterviewTime limit4sMemory limit1024 MB
Given a friendship graph, find the size of the largest connected group, since each person's friends must be abducted together.
- Level
Easy3 of 10
- Topics
- Graph, Union-find, BFS
- Solved
- No attempts yet
Problem
Aliens are visiting Earth, and as usual, they plan to abduct humans for their experiments. In the past, alien abductions drew a lot of press coverage and wild speculation. Luckily for them, most people do not believe these stories and think aliens are not real.
To keep a low profile in the future, the Galactic Committee for Person Captures (GCPC) has set rules for abductions. The aliens must prepare each abduction carefully. They may make multiple trips (alien travel is so fast in practice that this is no real limitation), but they must be smart about it so that humans do not discover their secret. If aliens want to abduct a person, they must abduct all of that person's friends at the same time, so that no one notices a friend is missing when they try to hang out. Friendships on Earth are bidirectional: if Alice is a friend of Bob, then Bob is also a friend of Alice.
The aliens have observed their targets and recorded all their friendships. In total, they must abduct people, including their friends. They want to book a starship and need to know how much space it requires to abduct all people. A starship's storage space is measured by the number of people it can transport at the same time. What is the minimum storage space required to abduct all people?
Input
The first line contains two integers and (, ), the number of people and the number of friendships. Each of the next lines contains two integers and (), meaning persons and are friends. No friendship is listed more than once.
Output
Print the minimum storage space needed to abduct all people.