K-query - MarisaOJ: Marisa Online Judge

K-query

Time limit: 1000 ms
Memory limit: 256 MB
You are given array A of n integers. There are q queries, each of the form (l,r,k), count the number of numbers larger than k in the subarray Al,Al+1,...,Ar. ### Input - The first line contains 2 integers n,q. - The second line contains n integers Ai. - The next q lines, each line contains 3 integers l,r,k, a query. ### Output - Print q integers, the answers to q queries. ### Constraints - 1≤n,q≤105. - 1≤Ai,k≤109. ### Example Input: 5312232131152345 Output: 210