303281: CF635A. Orchestra
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Orchestra
题意翻译
- 在一个 $r \times c$ 的矩阵中有 $n$ 个点,问有多少个连续子矩阵至少包含 $k$ 个点。 - $r,c,n,k \le 10$。题目描述
Paul is at the orchestra. The string section is arranged in an $ r×c $ rectangular grid and is filled with violinists with the exception of $ n $ violists. Paul really likes violas, so he would like to take a picture including at least $ k $ 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 $ r $ , $ c $ , $ n $ , $ k $ ( $ 1<=r,c,n<=10 $ , $ 1<=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 $ n $ lines each contain two integers $ x_{i} $ and $ y_{i} $ ( $ 1<=x_{i}<=r $ , $ 1<=y_{i}<=c $ ): the position of the $ i $ -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 $ k $ 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