Maximum
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Your task is very simple, and even without big legend: you just need to find the maximum on a segment.
Input
Initially the number of elements in array is given. The next line contains numbers — the initial array . Next line contains the number of queries . Each of the next lines contain two positive integers and — the segment, where you must find the maximum.
Output
For each query print the maximum on a segment.
Examples
Input #1
Answer #1
Submissions 6K
Acceptance rate 19%