| XIII UnB Contest Mirror |
|---|
| Finished |
In the year $$$2087$$$, humanity developed temporal communication technology, allowing messages to be sent to the past. You work at the Temporal Monitoring Center and need to process queries about these messages from the future.
You receive $$$N$$$ messages from the future, each with a timestamp $$$t_i$$$ indicating when the message was originally sent (in the future). Your system needs to respond to $$$Q$$$ queries, where each query asks: "How many messages were sent in the time interval [L, R]?"
First line: two integers $$$N$$$ and $$$Q$$$ $$$(1 \leq N, Q \leq 2 \cdot 10^5)$$$
Second line: $$$N$$$ integers $$$t_i$$$ representing the timestamps of the messages $$$(1 \leq t_i \leq 10^9)$$$
The next $$$Q$$$ lines: two integers $$$L$$$ and $$$R$$$ for each query $$$(1 \leq L \leq R \leq 10^9)$$$
For each query, print the number of messages received in the closed interval $$$[L, R]$$$.
5 310 1 10 7 51 56 102 4
2 3 0
3 310 15 201 510 1015 25
0 1 2
6 5600 500 400 300 200 100100 10050 3501 1000000000401 600700 800
1 3 6 2 0
| Name |
|---|


