#K2671. Disjoint Plant Groups
Disjoint Plant Groups
Disjoint Plant Groups
You are given N plants. Each plant has three attributes: height, width, and growth rate. Two plants are considered connected if they share at least one common attribute. A group is defined as a set of plants that are all connected directly or indirectly through shared attributes.
Your task is to determine the minimum number of disjoint groups that can be formed from the given list of plants.
Note: Two plants are in the same group if there exists a chain of plants connecting them, where each adjacent pair in the chain shares at least one attribute.
inputFormat
The first line contains an integer N, the number of plants.
Each of the next N lines contains three space-separated integers representing the height, width, and growth rate of a plant.
outputFormat
Output a single integer representing the minimum number of disjoint groups formed.
## sample3
10 20 30
10 25 35
40 20 45
1
</p>