Problem 3378 · Hard

Count Connected Components in LCM Graph

Join two numbers whenever their lcm is within the threshold, using union-find, and count the groups left.

Open the interactive visualisation