SP23776 KQUERYO - K-Query Online
Description
Given a sequence of n numbers a $ _{1} $ , a $ _{2} $ , ..., a $ _{n} $ and a number of k-queries. A k-query is a triple (i, j, k) (1 greater than k in the subsequence a $ _{i} $ , a $ _{i+1} $ , ..., a $ _{j} $ .
Input Format
- Line 1: n (1
- Line 2: n numbers a $ _{1} $ , a $ _{2} $ , ..., a $ _{n} $ (1
- Line 3: q (1
- In the next q lines, each line contains 3 numbers a, b, c representing a k-query. You should do the following:
- i = a xor last\_ans
- j = b xor last\_ans
- k = c xor last\_ans
After that 1 Where last\_ans = the answer to the last query (for the first query it's 0).
Output Format
For each k-query (i, j, k), print the number of elements greater than k in the subsequence a $ _{i} $ , a $ _{i+1} $ , ..., a $ _{j} $ in a single line.