#P3732. [HAOI2017] 供给侧改革

    ID: 1277 远端评测题 2000ms 250MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2017河南各省省选排序进制字典树,Trie 树

[HAOI2017] 供给侧改革

Output Format

Output Q Q lines, each containing a single integer, the answer to the corresponding query.

6 3
010110
2 5
1 6
1 2
4
6
0

Hint

[Constraints and Notes]

Data Point Scale of n n Scale of Q Q
1,21, 2 20 \leqslant 20
3,43, 4 100 \leqslant 100
5,65, 6 5×103 \leqslant 5 \times 10^3
7,8,9,107, 8, 9, 10 105 \leqslant 10^5

For all testdata, it is guaranteed that n105 n \leqslant 10^5 , Q105 Q \leqslant 10^5 , 1L<Rn 1 \leqslant L < R \leqslant n , and the 01 \texttt{01} string is randomly generated.

Translated by ChatGPT 5