首页 > 其他分享 >HDU 6514 Monitor

HDU 6514 Monitor

时间:2023-03-17 18:14:13浏览次数:39  
标签:HDU x1 Monitor int d% 6514 x2 y1 y2

注意:

  1. 注意要用 scanf
  2. 注意多测
#include <iostream>
#include <vector>
using namespace std;
int n,m,q;
vector <vector <int> > a;
void insert (int x1,int y1,int x2,int y2,int d) {
	a[x1][y1] += d,a[x1][y2 + 1] -= d,a[x2 + 1][y1] -= d,a[x2 + 1][y2 + 1] += d;
}
int sum (int x1,int y1,int x2,int y2) {
	return a[x2][y2] - a[x1 - 1][y2] - a[x2][y1 - 1] + a[x1 - 1][y1 - 1];
}
int main () {
	while (~scanf ("%d%d",&n,&m)) {
		a.assign (n + 2,vector <int> (m + 2,0));
		int k;
		scanf ("%d",&k);
		while (k--) {
			int x1,y1,x2,y2;
			scanf ("%d%d%d%d",&x1,&y1,&x2,&y2);
			insert (x1,y1,x2,y2,1);
		}
		for (int i = 1;i <= n;i++) {
			for (int j = 1;j <= m;j++) a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
		}
		for (int i = 1;i <= n;i++) {
			for (int j = 1;j <= m;j++) a[i][j] = (bool)a[i][j];
		}
		for (int i = 1;i <= n;i++) {
			for (int j = 1;j <= m;j++) a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
		}
		scanf ("%d",&q);
		while (q--) {
			int x1,y1,x2,y2;
			scanf ("%d%d%d%d",&x1,&y1,&x2,&y2);
			if (sum (x1,y1,x2,y2) == (x2 - x1 + 1) * (y2 - y1 + 1)) puts ("YES");
			else puts ("NO");
		}
	}
	return 0;
}

标签:HDU,x1,Monitor,int,d%,6514,x2,y1,y2
From: https://www.cnblogs.com/incra/p/17227749.html

相关文章

  • QOpenGLTimeMonitor Class
    DetailedDescriptionQOpenGLTimeMonitor类是一个便利的包装器,用于收集OpenGL计时查询对象,以测量您的渲染应用程序所需的粒度水平的GPU时间间隔。OpenGL计时查询对象按顺......
  • Robust RFID-Based Respiration Monitoring in Dynamic Environments
    基于RFID的呼吸监测在动态环境中的鲁棒性研究研究内容他们首先分析了移动人员对RFID信号的影响,发现移动人员会造成信号的衰减和多径效应,导致信号质量下降和相位跳变。为......
  • HDU2199 Can you solve this equation? (二分查找)
    Canyousolvethisequation?TimeLimit:2000/1000MS(Java/Others)    MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):12794    AcceptedS......
  • hdu 5288 OO’s Sequence
    题目链接:​​http://acm.hdu.edu.cn/showproblem.php?pid=5288​​解法:定义两个数组L[i],R[i],表示第i数左侧和右侧最接近它且值是a[i]因子的数字的位置,那么第i个数能贡献......
  • hdu 5339 Untitled【搜索】
    题目链接:​​http://acm.hdu.edu.cn/showproblem.php?pid=5339​​题意:一个整数a和一个数组b,问你是否能在b中取出r个元素排列组成c数组满足a%c1%c1%…..%cr==0。输出最小......
  • hdu-2063 二分图
    http://acm.hdu.edu.cn/showproblem.php?pid=2063过山车TimeLimit:1000/1000MS(Java/Others)    MemoryLimit:32768/32768K(Java/Others)TotalSubmi......
  • hdu-1010
    简单深搜剪枝http://acm.hdu.edu.cn/showproblem.php?pid=1010#include<iostream>#include<algorithm>#include<set>#include<map>#include<string.h>#inc......
  • hdu-1301
    模板题#include<iostream>#defineINF999999usingnamespacestd;intmap[30][30],dis[30],v[30];intprim(intn){inti,j,k,min,sum=0;for(i=1;i<=n......
  • hdu-1495
    bfs六种状态 #include<stdio.h>#include<iostream>#include<math.h>#include<stdlib.h>#include<ctype.h>#include<algorithm>#include<vector>#include<st......
  • hdu-2614
    取得第一个是第一个任务,时间0,接着进行下一个任务。#include<stdio.h>#include<iostream>#include<math.h>#include<stdlib.h>#include<ctype.h>#include<alg......