ARC032B
B - Road construction
https://gyazo.com/3a26d2a43f71527ecac92f4e128b7046
Thoughts.
Count the number of connected components -1
UnionFind
Official Explanation
The number of connected components should be counted as root(i)=i
ARC032
---
This page is auto-translated from /nishio/ARC032B using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.