last_label, all of them unpainted at first. Paint jobs come one by one: paints[i] = [ball, color] means ball ball is painted with colour color (its previous colour, if any, is gone).
After each paint job, count how many different colours the balls currently show; an unpainted ball adds no colour. Return these counts in the order of the paint jobs.last_label=3, paints=[[0, 7], [1, 7], [0, 2], [1, 2]] → [1, 1, 2, 1]
After each paint the colours in use are {7}, {7}, {7, 2}, {2}, so the answer is [1, 1, 2, 1].
last_label=5, paints=[[4, 1], [4, 1], [2, 3]] → [1, 1, 2]
Repainting ball 4 with the same colour changes nothing.
last_label ≤ 10⁹paints) ≤ 10⁵paints[i][0] ≤ last_labelpaints[i][1] ≤ 10⁹last_label=3, paints=[[0, 7], [1, 7], [0, 2], [1, 2]]
[1, 1, 2, 1]
Run checks the first 3 tests in your browser. Submit checks all 49 tests on the server, hidden ones included.