#P2709. 【模板】莫队 / 小B的询问
【模板】莫队 / 小B的询问
Description
Xiao B has an integer sequence of length , with values in . He has queries. For each query, given an interval , compute:
where denotes the number of occurrences of the number in .
Please help Xiao B answer the queries.
Input Format
The first line contains three integers .
The second line contains integers, representing Xiao B's sequence.
Each of the next lines contains two integers .
Output Format
Output lines. Each line contains one integer, which is the answer to a query.
6 4 3
1 3 2 1 1 3
1 4
2 6
3 5
5 6
6
9
5
2
Hint
Constraints
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号