A. Orchestra
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

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 xi and yi (1 ≤ xi ≤ r, 1 ≤ yi ≤ c): the position of the i-th viola. It is guaranteed that no location appears more than once in the input.

Output

Print a single integer — the number of photographs Paul can take which include at least k violas.

Examples
Input
2 2 1 1
1 2
Output
4
Input
3 2 3 3
1 1
3 1
2 2
Output
1
Input
3 2 3 2
1 1
3 1
2 2
Output
4
Note

We will use '*' to denote violinists and '#' to denote violists.

In the first sample, the orchestra looks as follows

*#
**

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.

题意: r*c的矩阵  n个位置特殊 并给出坐标  问能取多少个子矩阵使得其中特殊位置的个数最小为k

题解: 暴力 矩阵最多10*10  子矩阵 数量很小   (水)

 #include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
using namespace std;
int r,c,n,k;
int mp[][];
int main()
{
scanf("%d %d %d %d",&r,&c,&n,&k);
for(int i=; i<=n; i++)
scanf("%d %d",&mp[i][],&mp[i][]);
int re=;
for(int i=; i<=r; i++)
{
for(int j=; j<=c; j++)
{
for(int kk=i; kk<=r; kk++)
{
for(int g=j; g<=c; g++)
{
int jishu=;
for(int m=; m<=n; m++)
{
if(mp[m][]<=kk&&mp[m][]>=i&&mp[m][]<=g&&mp[m][]>=j)
jishu++;
}
if(jishu>=k)
re++;
}
}
}
}
printf("%d\n",re);
return ;
}

8VC Venture Cup 2016 - Final Round (Div. 2 Edition) A的更多相关文章

  1. 8VC Venture Cup 2016 - Final Round (Div. 2 Edition)

    暴力 A - Orchestra import java.io.*; import java.util.*; public class Main { public static void main(S ...

  2. 8VC Venture Cup 2016 - Final Round (Div. 1 Edition) E - Preorder Test 树形dp

    E - Preorder Test 思路:想到二分答案了之后就不难啦, 对于每个答案用树形dp取check, 如果二分的值是val, dp[ i ]表示 i 这棵子树答案不低于val的可以访问的 最多 ...

  3. 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) D. Factory Repairs 树状数组

    D. Factory Repairs 题目连接: http://www.codeforces.com/contest/635/problem/D Description A factory produ ...

  4. 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) C. XOR Equation 数学

    C. XOR Equation 题目连接: http://www.codeforces.com/contest/635/problem/C Description Two positive integ ...

  5. 8VC Venture Cup 2016 - Final Round (Div. 2 Edition)B. sland Puzzle 水题

    B. sland Puzzle 题目连接: http://www.codeforces.com/contest/635/problem/B Description A remote island ch ...

  6. 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) A. Orchestra 水题

    A. Orchestra 题目连接: http://www.codeforces.com/contest/635/problem/A Description Paul is at the orches ...

  7. Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition) E - Nikita and stack 线段树好题

    http://codeforces.com/contest/760/problem/E 题目大意:现在对栈有m个操作,但是顺序是乱的,现在每输入一个操作要求你输出当前的栈顶, 注意,已有操作要按它们的 ...

  8. Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition) D - Travel Card

    D - Travel Card 思路:dp,类似于单调队列优化. 其实可以写的更简单... #include<bits/stdc++.h> #define LL long long #de ...

  9. Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition)A 水 B 二分 C并查集

    A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

随机推荐

  1. 「雅礼集训 2017 Day1」市场 (线段树除法,区间最小,区间查询)

    老师说,你们暴力求除法也整不了多少次就归一了,暴力就好了(应该只有log(n)次) 于是暴力啊暴力,结果我归天了. 好吧,在各种题解的摧残下,我终于出了一篇巨好看(chou lou)代码(很多结构体党 ...

  2. Click Once使用总结

    做了一个CS结构软件,有十几个用户使用的客户端,因为刚开始试用期间,要不断根据用户使用情况修正问题和添加新功能,所以频繁更新是不可避免的,暂时没有深入去研究软件更新,暂时采取的方式是用户通过FTP自行 ...

  3. Python3中@的作用

    可能是自己理解能力差,网上看了一大堆教程,完全没搞懂. 自己敲几行代码,终于理解是怎么回事了. #python 3.6 #!/usr/bin/env python # -*- coding:utf-8 ...

  4. Laxcus大数据管理系统2.0(6)- 第四章 数据计算

    第四章 数据计算 Laxcus所有数据计算工作都是通过网络实施.相较于集中计算,在网络间进行的数据计算更适合处理那些数据量大.复杂的.耗时长的计算任务.能够实施网络计算的前提是数据可以被分割,就是把一 ...

  5. 使用truffle测试部署合约

    truffle console let contract; contract=BloggerCoin.deployed().then(instance=>contract=instanc e);

  6. 官方文档 恢复备份指南二 Getting Started with RMAN

    本章对RMAN进行基本的熟悉和了解   1.Overview of the RMAN Environment    RMAN运行时需要的最小环境:      target database       ...

  7. OpenCV学习4-----K-Nearest Neighbors(KNN)demo

    最近用到KNN方法,学习一下OpenCV给出的demo. demo大意是随机生成两团二维空间中的点,然后在500*500的二维空间平面上,计算每一个点属于哪一个类,然后用红色和绿色显示出来每一个点 如 ...

  8. 20172330 2017-2018-1 《Java程序设计》第八周学习总结

    学号 2017-2018-1 <程序设计与数据结构>第八周学习总结 教材学习内容总结 这一章主要是对多态性的学习: 由继承实现多态性 多态性引用能够随时间变化指向不同类型的对象. 对于多态 ...

  9. Java中I/O流之轮换流

    Java 中的轮换流: 非常有用,可以把一个字节流转换成字符流. inputStreamReader, outputStreamReader Demo_1: import java.io.*; cla ...

  10. 移动端调试和fiddler移动端抓包使用

    这里介绍一款移动端的调试工具以及抓包工具fiddler的使用.也是初次接触,算是初次接触的总结. 1,移动端调试工具.手机截图如下 代码实现 <!DOCTYPE html> <htm ...