请求修改题面
查看原帖
请求修改题面
737038
__11jiang08__楼主2023/5/3 09:11

原题面没有树脂

题目描述:

Ada the Ladybug is a farmer. She has a long furrow in which she grows trees. Each tree has some weight. The task is simple, she wants to know the biggest tree on some part of the furrow which is not greater than some height H. As Ada asks for this very often, she asked you to write a program for this.

输入格式:

The first line will contain two integer 1≤N,Q≤3×1051 \leq N,Q \leq 3\times 10^5, the number trees and the number of questions.

The next line will contain NN integers 0≤Ai≤1060 \le Ai \le 10^6, the heights of trees.

The sum next QQ will contain three integers: 0≤l≤r<N0 \le l \le r < N, the segment of furrow she is interested in and 0≤H≤1060\le H \le 10^6

输出格式:

For each query output either the size of highest tree lesser/equal to H or output 00 if such tree doesn't grow on given segment.

输入输出样例:

输入样例 #1

9 8
1 5 9 11 9 7 6 2 1
1 6 4
1 6 10
0 8 97
0 8 4
1 4 5
2 6 8
2 8 5
3 3 12

输出样例 #1

0
9
11
2
5
7
2
11
2023/5/3 09:11
加载中...