EasyRating 1000
Narrow Lane
A lane has segments with given widths. For each query (i, j), print the narrowest width from segment i to j (counting from 0).
Input
n and t; then n widths; then t lines 'i j'.
Output
t lines.
Sample 1
Input
8 5 2 3 1 2 3 2 3 3 0 3 4 6 6 7 3 5 0 7
Output
1 2 3 2 1
Sample 2
Input
1 1 5 0 0
Output
5
Output appears here