#P2311. loidc,想想看
loidc,想想看
Description
Moreover, loidc has a special ability: he can foresee the future and accurately guess how many gold medals the Chinese team will win in any single unit of time. However, the workload is huge, and predicting gold medals consumes a lot of energy, so he cannot accurately determine which unit time within a given interval attains the maximum number of gold medals. This makes loidc quite upset. After thinking for a while, he thought of you, because he knows you are an OIer. He chuckled and handed the problem over to you. loidc hopes you can produce the answer within 1 s.
Description
Input Format
The first line contains an , indicating there are time intervals.
The next line contains numbers , where denotes the number of gold medals loidc predicts the Chinese team will win in the -th time interval.
Then, the third line contains a number , indicating loidc has queries.
The next lines each contain two numbers and , asking which unit time within the interval has the maximum number of gold medals.
loidc has a habit of asking questions in order; that is, each query is asked after the previous one.
Note that for the -th and -th queries, it strictly holds that and .
Output Format
Output lines. Each line contains a single , denoting the answer to the -th query.
5
2 3 4 5 6
5
1 1
1 2
2 3
3 4
4 5
1
2
3
4
5
Hint
: , .
: , .
All other input and output values are less than maxlongint.
The testdata guarantees are all distinct.
Translated by ChatGPT 5
京公网安备 11011102002149号