Range Queries with Mo's Algorithm and Block Decomposition
Problem Statement
Given a sequence of length n: S1, S2, S3, ..., Sn, process T queries. Each query provides four integers l, r, a, b. For all indices i ∈ [l, r], answer two questions:
Count of positions where Si ∈ [a, b]
Number of distinct values among Si that satisfy Si ∈ [a, b]
Constraints: n ≤ 10^5, T ≤ 10^6
Analysis of Failed Approaches
A ...
Posted on Wed, 03 Jun 2026 18:04:59 +0000 by saraadmin