Interval Less Query#5084

Interval Less Query

1 sekunt
128 megabaýt
Ýeňil

An array of integers is given. You need to answer queries. For each query, determine how many numbers in the segment [l, r] have values less than .

Giriş

The first line contains one integer n~(1 \le n \le 2 \cdot 10^5) — the length of the array.

The second line contains integers — the elements of the array.

The third line contains one integer q~(1 \le q \le 10^5) — the number of queries.

Each of the following lines describes a query and contains three integers , , and x~(l \le r, 1 \le x \le 10^9).

Çykyş

For each query, print in a separate line the number of elements in the segment [l, r] that are less than .

Mysallar

1-nji mysal

Loading
Loading