#P5677. [GZOI2017] 配对统计
[GZOI2017] 配对统计
Description
Given numbers .
For a pair , if for all , it satisfies , then is called a good pair ( denotes the absolute value of ).
You are given several queries. For each query, ask how many good pairs are contained in the interval .
That is, choose ( and ), and ask how many pairs are good pairs.
Input Format
The first line contains two positive integers .
The second line contains numbers .
In the next lines, each line gives two numbers .
Output Format
Let be the answer to the -th query. Output .
3 2
2 1 3
1 2
1 3
10
Hint
Sample Explanation
In the first query, the good pairs are: .
In the second query, the good pairs are: .
The answer .
Constraints

Translated by ChatGPT 5
京公网安备 11011102002149号