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

时间:2022-12-10 23:06:53

A. Orchestra

题目连接:

http://www.codeforces.com/contest/635/problem/A

Description

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.

Sample Input

2 2 1 1

1 2

Sample Output

4

Hint

题意

有一个r*c的矩阵,然后有n个点是特殊的点

然后问你里面有多少个子矩阵,其中至少有k个特殊的点

题解:

数据范围一看,才10

想怎么做就怎么做,瞎JB做就好了。

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn = 12;
int a[maxn][maxn];
int r,c,n,k;
int cal(int x,int x1,int y,int y1)
{
int ans = 0;
for(int i=x;i<=x1;i++)
for(int j=y;j<=y1;j++)
if(a[i][j])ans++;
return ans;
}
int main()
{
scanf("%d%d%d%d",&r,&c,&n,&k);
for(int i=1;i<=n;i++)
{
int x,y;
scanf("%d%d",&x,&y);
a[x][y]=1;
}
int ans = 0;
for(int i=1;i<=r;i++)for(int j=i;j<=r;j++)
for(int i1=1;i1<=c;i1++)for(int j1=i1;j1<=c;j1++)
if(cal(i,j,i1,j1)>=k)ans++;
cout<<ans<<endl;
}

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

  1. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 2 Edition&rpar;

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

  2. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 1 Edition&rpar; E - Preorder Test 树形dp

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

  3. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 2 Edition&rpar; A

    A. Orchestra time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  4. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 2 Edition&rpar; D&period; Factory Repairs 树状数组

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

  5. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 2 Edition&rpar; C&period; XOR Equation 数学

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

  6. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 2 Edition&rpar;B&period; sland Puzzle 水题

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

  7. Codeforces Round &num;393 &lpar;Div&period; 2&rpar; &lpar;8VC Venture Cup 2017 - Final Round Div&period; 2 Edition&rpar; &Tab;E - Nikita and stack 线段树好题

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

  8. Codeforces Round &num;393 &lpar;Div&period; 2&rpar; &lpar;8VC Venture Cup 2017 - Final Round Div&period; 2 Edition&rpar; D - Travel Card

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

  9. Codeforces Round &num;393 &lpar;Div&period; 2&rpar; &lpar;8VC Venture Cup 2017 - Final Round Div&period; 2 Edition&rpar;A 水 B 二分 C并查集

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

随机推荐

  1. 从github获取代码

    以duilib为例: 1 建立一个文件夹,右键 git bash here. 2 git init 3 git clone https://github.com/duilib/duilib.git

  2. Nginx 启用 https

    在nginx.conf中增加新server配置 server { listen ; server_name www.some.com; ssl on; ssl_certificate sslkey/s ...

  3. 二叉搜索树的后序遍历路径(《剑指offer》面试题24)

    题目:输入一个整数数组,判断该数组是不是二叉搜索树的后序遍历序列的结果,如果是,则返回true,如果不是则返回false.假设输入的数组的任意两个数字都互不相同. 分析:在后序遍历得到的序列中,最后一 ...

  4. MongoDB 启动mongo不带DB

    > mongo --nodb > conn = new Mongo("localhost:27017"); > db = conn.getDB("tes ...

  5. 在VMware安装Centos再安装Oracle数据库(个人学习使用)

    打开VMware 选择稍后安装 自定义安装 小生安装的是64位的Centos 给虚拟机设置名称和安装位置 设置虚拟机打处理器并分配内存(oracle12G我建议内存为2G以上) 网络类型选择仅主机模式 ...

  6. C语言宏的高级应用

    原文:C语言宏的高级应用 关于#和##在C语言的宏中,#的功能是将其后面的宏参数进行字符串化操作(Stringfication),简单说就是在对它所引用的宏变量通过替换后在其左右各加上一个双引号.比如 ...

  7. 字符串的拼接python

    数字可以强制转换为字符串,但是字符串不能强制转换为数字(会报错) a='abcs' b='dsys' 方法一.a+b 最low的一个方法,因为每+一次内存增加一次 方法二.print '%s%s'%( ...

  8. 阿里面试题BIO和NIO数量问题附答案和代码

    一.问题 BIO 和 NIO 作为 Server 端,当建立了 10 个连接时,分别产生多少个线程? 答案: 因为传统的 IO 也就是 BIO 是同步线程堵塞的,所以每个连接都要分配一个专用线程来处理 ...

  9. FFT算法详解

    啊…本来觉得这是个比较良心的算法没想到这么抽搐这个算法真是将一个人的自学能力锻炼到了极致qwqqwqqwq 好的,那我们就开始我们的飞飞兔FFTFFTFFT算法吧! 偷偷说一句,FFTFFTFFT的代 ...

  10. Python中property的使用