#B. 考验(1)

    Type: Default 1000ms 256MiB

考验(1)

No testdata at current.

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

给你一个长度为n的数组a,有m次询问,每次给你一个区间(l,r),请你求出a数组区间(l,r)里的最大值。

Format

Input

第一行两个正整数,n,m。第二行n个整数,表示数组a。后面m行,每行两个正整数,l,r。

Output

m行。对于每次询问,输出答案。

Samples

5 4
2 4 3 1 5
1 5
2 4
4 4
1 2
5
4
1
4

Limitation

1s, 1024KiB for each test case. 对于40%的数据,1n,m1031≤n,m≤10^3 对于100%的数据,1lrn1051m21061≤l≤r≤n≤10^5,1≤m≤2*10^6

考验

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
4
Start at
2022-11-12 10:45
End at
2022-12-19 22:45
Duration
900 hour(s)
Host
Partic.
6