#P2249. 【深基13.例1】查找
【深基13.例1】查找
Problem Description
Input non-negative integers that are non-decreasing (meaning each later number is not smaller than the previous one), and each does not exceed . Then perform queries. For each query, an integer is given. You need to output the index of the first occurrence of this number in the sequence. If it is not found, output .
Input Format
The first line contains two integers and , representing the number of integers and the number of queries.
The second line contains integers, representing the numbers to be queried.
The third line contains integers, representing the query numbers. The indices start from .
Output Format
Output one line containing integers separated by spaces, representing the answers.
11 3
1 3 3 3 5 7 9 11 13 15 15
1 3 6
1 2 -1
Hint
Constraints: , , .
The input and output size of this problem is large. Please use fast I/O methods.
Translated by ChatGPT 5