NC237465. Segment
描述
输入描述
The first line contains two integer(
), denoting the length of the array
and the number of queries.
The second line containsintegers
(
).
Each of the following blocks of lines contains the description of one query.
For each query, the first line contains an integer, denotes the number of segments. The following
lines contains two integers
(
), representing the
segments in the query.
It guaranteed that,
.
输出描述
For each query, output a number in a line indicating the answer.
示例1
输入:
5 2 5 4 2 3 1 3 1 1 2 3 4 4 2 1 2 3 4
输出:
1 0