report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
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 $A_l,A_{l + 1},...,A_r$. ### Input - The first line contains 2 integers $n, q$. - The second line contains $n$ integers $A_i$. - 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 \le n, q\le 10^5$. - $1 \le A_i, k \le 10^9$. ### Example Input: ``` 5 3 1 2 2 3 2 1 3 1 1 5 2 3 4 5 ``` Output: ``` 2 1 0 ```
Introduction to Segment Tree and Binary Indexed Tree
Point update, sum query
Point update, minimum query
Range update, sum query
Range update, minimum query
Apple picking
Non-negative subarray
Inversions
K-query
Divisible by 3
Mushroom harvesting
KSS
D-query
Greatest subarray sum
Copying data
Within 1
Within 2
Ladder update
Racing
One time
Subarray XOR
String sorting
Odd query
Full sequence
Topic
Data structure
Rating 1500
Solution (0) Solution