如果对应矩形的坐标不同,则认为两张图片不同。
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.
2 2 1 1 1 2
4
3 2 3 3 1 1 3 1 2 2
1
3 2 3 2 1 1 3 1 2 2
4
*# **Paul can take a photograph of just the viola, the 1×2 column containing the viola, the 2×1 row containing the viola, or the entire string section, for 4 pictures total. In the second sample, the orchestra looks as follows
#* *# #*Paul must take a photograph of the entire section. In the third sample, the orchestra looks the same as in the second sample.
第一行input包含四个空格分隔的整数r,c,n,k(1≤r,c,n≤10,1≤k≤n)−字符串部分的行数和列数,总数中提琴的数量,以及Paul希望在他的照片中出现的最少中提琴数量。
接下来n行每行包含两个整数xi和yi(1≤xi≤r,1≤yi≤c):第i把中提琴的位置。保证没有位置在输入中出现超过一次。
2 2 1 1 1 2
4
3 2 3 3 1 1 3 1 2 2
1
3 2 3 2 1 1 3 1 2 2
4
2 2 1 1
1 2
4
我们将用“*”表示小提琴手,用“#”表示中提琴手。
在第一个示例中,管弦乐队看起来如下所示
* #
**
Paul可以只拍摄中提琴的照片,1×2列包含中提琴,2×1行包含中提琴,或整个弦乐部分,总共4张照片。在第二个样本中,管弦乐队是这样的
# *
* #
# *
保罗必须拍下整个区域的照片。在第三个样本中,管弦乐队看起来和第二个样本中一样。