#C8564. Minimum Temperature in Intervals

    ID: 52560 Type: Default 1000ms 256MiB

Minimum Temperature in Intervals

Minimum Temperature in Intervals

You are given an array \(T\) of daily temperatures and a number of queries. For each query, which is represented by a pair of indices \((L, R)\), your task is to determine the minimum temperature recorded between days \(L\) and \(R\) (inclusive).

Input Format: The input is provided via standard input (stdin). The first line contains an integer \(N\) denoting the number of days. The second line contains \(N\) space-separated integers representing the daily temperatures. The third line contains an integer \(M\) representing the number of queries. The fourth line contains \(2M\) space-separated integers where each pair \(L\) and \(R\) represents a query interval.

Output Format: For each query, output the minimum temperature found in the corresponding interval. The results should be printed in a single line, separated by spaces.

Example:

Input:\nbsp;
5
10 22 5 3 15
3
0 2 1 4 3 3

Output:
5 3 3

inputFormat

The first line contains an integer \(N\) (the number of days).
The second line contains \(N\) space-separated integers, representing the daily temperatures \(T[0], T[1], \ldots, T[N-1]\).
The third line contains an integer \(M\) (the number of queries).
The fourth line contains \(2M\) space-separated integers where every two consecutive integers represent a query interval \((L, R)\).

outputFormat

Print \(M\) integers in one line separated by a single space, where each integer is the minimum temperature in the corresponding query interval.

## sample
5
10 22 5 3 15
3
0 2 1 4 3 3
5 3 3