Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Contest 2-B: Island Mergers

โญ beginnerโณ 40 min read๐Ÿ“ Lesson 194 of 281

Mock contest 2, problem B: component count after every union (DSU with a counter). Target: solved within 40 minutes.

Contest 2-B โ€” Island Mergers. DSU plus one integer: components start at n and drop by one per successful union. Graded near-miss: recounting roots per query โ€” correct but O(n*k).

Contest 2-B. The wrong version produces the right answers on small data and times out at full load: 200000 rescans of 200000 nodes.