luogu#P5048. [Ynoi2019 模拟赛] Yuno loves sqrt technology III
[Ynoi2019 模拟赛] Yuno loves sqrt technology III
Background

Problem Description
You are given a sequence of length and queries. For each query, you need to output the number of occurrences of the mode in a given interval, and the queries are forced to be online.
Input Format
The first line contains two integers .
The second line contains integers representing the sequence.
Then follow lines, each containing two numbers representing the query interval.
This problem is forced to be online: in each query, the input numbers should be with . For the first query, by default.
Output Format
Output lines, each line contains one integer representing the answer to the query.
4 1
2 3 3 3
2 4
3
Hint
。
There exists an algorithm.
Source By nzhtl1477.
Translated by ChatGPT 5