#P2310. loidc,看看海
loidc,看看海
Description
loidc plans to take the LOI team members to the seaside to have fun after the exam. So he wants to write a program to let them understand the wave conditions over a period of time.
His command is entered like this:
This asks, within time , for the unit time index at which the -th smallest wave height occurs.
But when he was just about to open Dev-pas++, loidc found that his computer was broken. Being lazy as always, he asks you for help. He hopes you can finish the program within second.
Of course, loidc will tell you the wave height for all time indices in advance, so rest assured. As for how he obtained them, that is unknown.
Input Format
- The first line contains an integer , the total number of time indices.
- The second line contains numbers , in order, representing the wave height at each of the unit time indices. It is guaranteed that all time indices have pairwise distinct wave heights.
- The third line contains an integer , the number of queries.
- The next lines each contain integers , representing one query.
Output Format
Output lines, each being the answer to one query.
5
1 2 3 4 5
3
2 4 2
1 5 1
3 3 1
3
1
3
Hint
- For of the testdata, .
- Constraints: For of the testdata, , and are pairwise distinct, , .
Translated by ChatGPT 5
京公网安备 11011102002149号