CF635A.Orchestra

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Paul is at the orchestra. The string section is arranged in an r×cr×c rectangular grid and is filled with violinists with the exception of nn violists. Paul really likes violas, so he would like to take a picture including at least kk 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 rr , cc , nn , kk ( 1<=r,c,n<=101<=r,c,n<=10 , 1<=k<=n1<=k<=n ) — 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 nn lines each contain two integers xix_{i} and yiy_{i} ( 1<=xi<=r1<=x_{i}<=r , 1<=yi<=c1<=y_{i}<=c ): the position of the ii -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 kk violas.

输入输出样例

  • 输入#1

    2 2 1 1
    1 2
    

    输出#1

    4
    
  • 输入#2

    3 2 3 3
    1 1
    3 1
    2 2
    

    输出#2

    1
    
  • 输入#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 1×21×2 column containing the viola, the 2×12×1 row containing the viola, or the entire string section, for 44 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.

首页