QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#18802. Последовательность и Запрос 44

Statistiques

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

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

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

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

Следующие $Q$ строк содержат по одному запросу в описанном выше формате.

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

Для каждого запроса выведите ответ на отдельной строке.

Примеры

Ввод 1

11 6
9 6 3 1 5 12 8 4 2 2 2
5 1
7 2
9 1
9 2
11 1
11 11

Вывод 1

4
6
5
8
7
11

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.