Комментарии
На Proof_by_QED → Codeforces Round 998 (Div. 3), 22 месяца назад
+1

No, I solved this problem without DSU, just a couple of DFS.