关于题目内容
查看原帖
关于题目内容
737038
__11jiang08__楼主2022/7/17 11:04

SP32947题排版混乱,信息不完整,请求修改

正确题面:

题目描述

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 1N,Q31051 \le N,Q \le 3*10^5 , the number trees and the number of questions.

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

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

输出格式

For each query output either the size of highest tree lesser/equal to H or output 0 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
2022/7/17 11:04
加载中...