CT48251
The signals at Ashfall
MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60
The council of the ember dunes of Ashfall pays by the answer, and Lamplighter intends to earn it. First: the full register of signals.
Task: n isolated nodes are joined by m edges (some may be redundant). Print the minimum number of additional edges needed to make the graph connected.
Input format: First line: n and m. Next m lines: u v.
Output format: Print the number of extra edges needed.
Constraints: 1 <= n <= 4000; 0 <= m <= 4000.
Constraints:
1 <= n <= 4000; 0 <= m <= 4000.