Counting Distinct Colors with Point Updates Using Block Decomposition

Consider an array of N colored elements where some colors may repeat. We need to support two operations efficiently: query the number of distinct colors in a given range [L, R], and update a single position to a new color. This problem, known as "Color/Queue Maintenance" on BZOJ, requires a careful balance between query and update ope ...

Posted on Sun, 18 Oct 2026 16:11:56 +0000 by kiwi_uk