CodeForces 635A Orchestra(水题)

本文概述了AI音视频处理领域的关键技术,包括视频分割、语义识别、自动驾驶、AR、SLAM等,并探讨了其在实际应用中的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题意:给你一个rxc的矩阵,其中有n个特殊的点,问有多少个子矩阵可以满足特殊的点大于等于k

思路:由于数据只有10....所以xib做就好


#include <cstdio>
#include <queue>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <ctime>
#include <cmath>
#include <cctype>
using namespace std;
#define maxn 100000
#define LL long long
int cas=1,T;
int a[12][12];
int r,c,n,k;
int check(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()
{
	while (scanf("%d%d%d%d",&r,&c,&n,&k)!=EOF)
	{
		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 ii=1;ii<=c;ii++)
					for (int jj = ii;jj<=c;jj++)
						if (check(i,j,ii,jj)>=k)
							ans++;
		printf("%d\n",ans);
	}
	//freopen("in","r",stdin);
	//scanf("%d",&T);
	//printf("time=%.3lf",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

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 nviolists. 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 rcnk (1 ≤ r, c, n ≤ 101 ≤ 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 ≤ r1 ≤ 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

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值