Question about range queries

Revision en6, by tuncypasha, 2025-07-08 19:59:36

Given an integer $$$n$$$, the next line contains $$$n$$$ integer. Third line contains an integer $$$q$$$. The next $$$q$$$ lines, contains $$$q$$$ queries. Query format is $$$l_i$$$, $$$r_i$$$. You have to answer to queries like this. If all the numbers that are less or equal than its index, that is, $$$a_l$$$ $$$≤$$$ $$$0$$$, $$$a_{l + 1}$$$ $$$≤$$$ $$$1$$$, $$${...}$$$, $$$a_r$$$ $$$≤$$$ $$${r - l}$$$.

Constraints are $$$n$$$ $$$≤$$$ $$$2 • {10 ^ 5}$$$, $$$q$$$ $$$≤$$$ $$$2 • {10 ^ 5}$$$.

Can you help me to solve this problem?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English tuncypasha 2025-07-08 20:00:59 4
en6 English tuncypasha 2025-07-08 19:59:36 4
en5 English tuncypasha 2025-07-08 19:57:59 91 (published)
en4 English tuncypasha 2025-07-08 19:52:02 4 Tiny change: '=$ ${r - l + 1}$.\n\nCan' -> '=$ ${r - l}$.\n\nCan' (saved to drafts)
en3 English tuncypasha 2025-07-08 19:51:26 101
en2 English tuncypasha 2025-07-08 19:49:18 115
en1 English tuncypasha 2025-07-08 19:47:04 193 Initial revision (published)