Sequence and Queries 1
Time limit1sMemory limit512 MB
Given a static sequence, answer M queries counting how many values in range A[i..j] are greater than k.
- Level
Hard8 of 10
- Topics
- Segment tree, Sorting, Binary search, Divide and conquer
- Solved
- No attempts yet
Problem
You are given a sequence of length . Write a program that processes the following query.
i j k: print how many elements among are greater than .
Input
The first line contains the size of the sequence, . ()
The second line contains separated by spaces. ()
The third line contains the number of queries, . ()
Each of the next lines contains one query as , , in that order. (, )
Output
Print the answer to each query on its own line, in the order the queries are given.