QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 512 MB 満点: 100

#18764. Последовательность и запрос 6

統計

Дана последовательность $A_1, A_2, \ldots, A_N$ длины $N$. Напишите программу, которая выполняет следующие запросы:

  • i j: вывести количество вхождений самого частого числа среди $A_i, A_{i+1}, \ldots, A_j$.

Входные данные

Первая строка содержит длину $N$ последовательности $(1 \le N \le 100{,}000)$.

Вторая строка содержит $A_1, A_2, \ldots, A_N$ $(1 \le A_i \le 100{,}000)$.

Третья строка содержит количество $M$ запросов $(1 \le M \le 100{,}000)$.

Следующие $M$ строк содержат по одному запросу $i, j$ $(1 \le i \le j \le n)$.

Выходные данные

Для каждого запроса выведите одну строку, содержащую ответ.

Примеры

Входные данные 1

5
1 2 1 3 3
3
1 3
2 3
1 5

Выходные данные 1

2
1
2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.