This time Agent Ω was able to compromise several drone

$24.99 $18.99

The description provided for this problem: This time Agent Ω was able to compromise several drone swarms and monitor the messages the Lion was sending to them. She could tell that he was having the swarms coordinate multiple attacks. But how many? Given a graph of which swarms are coordinating (vertices are swarms and edges…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:

Description

5/5 – (2 votes)

The description provided for this problem:

This time Agent Ω was able to compromise several drone swarms and monitor the messages the Lion was sending to them. She could tell that he was having the swarms coordinate multiple attacks. But how many?

Given a graph of which swarms are coordinating (vertices are swarms and edges indicate a pair of swarms are working together), can you figure out how many distinct missions the swarms are going on? If there is a coordination path between any two swarms that means they are on the same mission. If there is no path between them, they are on different missions.

Input Format

The first line contains N, the number of swarms being sent orders, and M, the number of pairs of swarms that are coordinating.

The next M lines each have two values identifying a pair of coordinating swarms.

Constraints

1 ≤ N ≤ 200

1 ≤ M ≤ 10,000

0 ≤ swarm IDs < N

Output Format

Print the number of indepent missions in the input graph.

Example 0

Sample Input

9 10

0 3

0 4

0 5

1 2

1 6

1 8

2 8

3 7

4 7

6 8

Sample Output

2

This time Agent Ω was able to compromise several drone
$24.99 $18.99