Problem 3447 · Medium

Assign Elements to Groups with Constraints

Record each element value's first index, then sieve over multiples so every group size knows the smallest index of an element that divides it.

Open the interactive visualisation