#K72147. Subarray Query Check
Subarray Query Check
Subarray Query Check
You are given an array of n integers and q queries. Each query contains three integers l, r, and k. For each query, you need to determine whether there exists an element in the subarray from index l to r (1-indexed) that is strictly greater than k.
In mathematical terms, for each query, check if there exists an index \( i \) such that \( l \le i \le r \) and \( a_i > k \). If such an element exists, output "Yes"; otherwise, output "No".
Read input from the standard input and write the results to the standard output.
inputFormat
The first line contains two integers n and q denoting the number of elements in the array and the number of queries, respectively.
The second line contains n space-separated integers representing the array.
Each of the following q lines contains three integers l, r, and k describing a query.
outputFormat
For each query, output a single line with "Yes" if there exists an element in the specified subarray that is greater than k, otherwise output "No".
## sample5 1
1 3 5 7 9
1 3 4
Yes
</p>