SP32900 KDOMINO - K-dominant array
Description
Professor Mahammad was sitting in his garden when an apple fell on his head, and in a stroke of brilliant insight, he suddenly came up with _K-dominant notation_. An array with length _L_ is called _K-dominant_, if and only if there is at least one element _x_ lying in the array for which **occurence(x) \* K >= L**. After analyzing several arrays with this property, professor now, made up a new problem for you. Your task is simple, there are given an array of length N and several queries. For each of the queries, you just need to check whether _the subarray \[l, r\] is k-dominant or not_.
Input Format
The first line of the input contains two positive integers **N** and **Q**, the number of elements of the array and the mean, respectively. (**N, Q ).**
The following line contains N integers which represent elements of the array.
The following Q lines contains three integers **l**, **r**, and **k**. (**1 ).**
**All the numbers in the input section are 32-bit positive integers.**
**Sum of all k's in queries does not exceed 500000.**
Output Format
For each of the queries, print per line **YES** or **NO** if there is an element lying in the subarray which satisfies the condition in the statement.