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 (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) 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 (Div. 2 Edition) D. Factory Repairs 树状数组

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

  5. 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 ...

  6. 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 ...

  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. perl6 修改文件并覆盖

    use v6; my $filename = 'data.txt'; my $data = slurp $filename; say $data; $data ~~ s/'4'/'ABC'/; say ...

  2. 报错注入遇到ERROR 1242 (21000): Subquery returns more than 1 row解决方案

    我的SQL语句是这样写的. mysql> select 1,2,3 and updatexml(1,concat(1,(select user from mysql.user),1),1);ER ...

  3. Metlnfo cms后台getshell漏洞复现

    整体思路 挖掘伪全局变量 然后找可控参数进行利用#伪全局变量:可理解为全局变量,例部分CMS为了全局过滤SQL注入或者XSS之类的漏洞就会将GET.POST.COOKIE等请求借入全局然后直接过滤.这 ...

  4. gpio子系统和pinctrl子系统(中)

    pinctrl子系统核心实现分析 pinctrl子系统的内容在drivers/pinctrl文件夹下,主要文件有(建议先看看pinctrl内核文档Documentation/pinctrl.txt): ...

  5. HDU 5627 Clarke and MST &意义下最大生成树 贪心

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5627 题意:Bestcoder的一道题,让你求&意义下的最大生成树. 解法: 贪心,我们从高位 ...

  6. WiderFace标注格式转PASCAL VOC2007标注格式

    #coding=utf-8 import os import cv2 from xml.dom.minidom import Document def create_xml(boxes_dict,ta ...

  7. Leetcode 之Largest Rectangle in Histogram(40)

    又是一道构思巧妙的题,暴力求解复杂度太高,通过构造一个递增栈来解决:如果当前元素小于栈顶元素,则说明栈内已经构成一个 递增栈,则分别计算以每个元素为最低值的面积:反之,则入栈. int largest ...

  8. 测试php单例模式和静态访问,实例化访问的效率

    // 测试的类class Memory { private static $a= null; public function __construct() { return self::$a; } pu ...

  9. hdu 1806(线段树区间合并)

    Frequent values Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  10. EF6 Working with Proxies ProxyCreationEnabled

    When creating instances of POCO entity types, the Entity Framework often creates instances of a dyna ...