Submit

本题为2013年山东省省赛PROBLEM H

In this problem you are given a number
sequence P consisting of N integer and P_{i} is the i^{th} element in the sequence. Now you task is to answer a list of queries, for each
query, please tell us among [L, R], how many P_{i} is not less than A
and not greater than B( L<= i <= R). In other words, your task is to
count the number of P_{i} (L <= i <= R, A <= P_{i} <= B).

In the first line there is an integer T
(1 < T <= 50), indicates the number of test cases.

For each case, the first line
contains two numbers N and M (1 <= N, M <= 50000), the size of sequence
P, the number of queries. The second line contains N numbers P_{i}(1
<= P_{i} <= 10^9), the number sequence P. Then there are M lines,
each line contains four number L, R, A, B(1 <= L, R <= n, 1 <= A, B
<= 10^9)

For each case, at first output a line ‘Case #c:’, c is the case number start from 1. Then for each query output a line contains the answer.

```
1
13 5
6 9 5 2 3 6 8 7 3 2 5 1 4
1 13 1 10
1 13 3 6
3 6 3 6
2 8 2 8
1 9 1 9
```

```
Case #1:
13
7
3
6
9
```