#P1997. faebdc 的烦恼
faebdc 的烦恼
Description
There are problems in this contest, each with a difficulty value . Since the ace coder wangxz has already sorted these difficulty values in ascending order for Niaoge, he does not want to know which problems are easy or hard; he only wants to know, among some problems , how many times the most frequent difficulty value appears.
Your task is: for each query , tell him, among the problems from to , the number of occurrences of the most frequent difficulty value (there are queries in total).
If you succeed in helping Niaoge, he will take you through the NOI Qualifier.
Input Format
Each test point contains exactly one set of testdata.
The first line contains two integers, the number of problems and the number of queries .
The second line has integers; the -th integer is the difficulty of the -th problem.
Then follow lines, each with two integers , representing one query.
Output Format
For each query, output a single integer on its own line as the answer.
9 1
1 1 1 2 2 3 3 4 4
3 8
2
Hint
Constraints
对于全部的测试点,保证 ,,,。
Translated by ChatGPT 5
京公网安备 11011102002149号