#abc235c. C - The Kth Time Query
C - The Kth Time Query
Score : points
问题描述
我们有一序列包含 个数:。
处理以下 个查询。
-
查询 :给出一对整数 。让我们从头开始逐个查看 中的元素:,哪个元素会是数字 的第 次出现?
输出该元素的索引,如果不存在这样的元素,则输出 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a sequence of numbers: .
Process the queries explained below.
- Query : You are given a pair of integers . Let us look at the elements of one by one from the beginning: Which element will be the -th occurrence of the number ?
Print the index of that element, or if there is no such element.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer to Query .
Sample Input 1
6 8
1 1 2 3 1 2
1 1
1 2
1 3
1 4
2 1
2 2
2 3
4 1
Sample Output 1
1
2
5
-1
3
6
-1
-1
occurs in at . Thus, the answers to Query through are in this order.
Sample Input 2
3 2
0 1000000000 999999999
1000000000 1
123456789 1
Sample Output 2
2
-1
update @ 2024/3/10 10:11:29