#P1954. Orchestra
Orchestra
Orchestra
题面翻译
在一个 的矩阵中有 个点,问有多少个连续子矩阵至少包含 个点。
,。
题目描述
Paul is at the orchestra. The string section is arranged in an rectangular grid and is filled with violinists with the exception of violists. Paul really likes violas, so he would like to take a picture including at least of them. Paul can take a picture of any axis-parallel rectangle in the orchestra. Count the number of possible pictures that Paul can take.
Two pictures are considered to be different if the coordinates of corresponding rectangles are different.
输入格式
The first line of input contains four space-separated integers , , , ( , ) — the number of rows and columns of the string section, the total number of violas, and the minimum number of violas Paul would like in his photograph, respectively.
The next lines each contain two integers and ( , ): the position of the -th viola. It is guaranteed that no location appears more than once in the input.
输出格式
Print a single integer — the number of photographs Paul can take which include at least violas.
样例 #1
样例输入 #1
2 2 1 1
1 2
样例输出 #1
4
样例 #2
样例输入 #2
3 2 3 3
1 1
3 1
2 2
样例输出 #2
1
样例 #3
样例输入 #3
3 2 3 2
1 1
3 1
2 2
样例输出 #3
4
提示
We will use '*' to denote violinists and '#' to denote violists.
In the first sample, the orchestra looks as follows:
<br></br>*#<br></br>**<br></br>
Paul can take a photograph of just the viola, the column containing the viola, the row containing the viola, or the entire string section, for pictures total.In the second sample, the orchestra looks as follows:
<br></br>#*<br></br>*#<br></br>#*<br></br>
Paul must take a photograph of the entire section.In the third sample, the orchestra looks the same as in the second sample.