https://www.luogu.org/problem/show?pid=1847
类似铺地毯,把所有攻击范围存起来再根据询问统计模拟即可
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ms(i,j) memset(i, j, sizeof i);
struct node
{
int x1;
int y1;
int x2;
int y2;
}t[2005];
int n,m;
int main()
{
scanf("%d%d", &m, &n);
for (int i=1;i<=m;i++) scanf("%d%d%d%d",&t[i].x1, &t[i].y1, &t[i].x2, &t[i].y2);
for (int i=1;i<=n;i++)
{
int x,y;
scanf("%d%d", &x, &y);
int ans = 0;
int last = 0;
for (int j=1;j<=m;j++)
{
if (x>=t[j].x1&&x<=t[j].x2&&y>=t[j].y1&&y<=t[j].y2)
{
ans++;
last = j;
}
}
if (ans==0) printf("NO\n");
else printf("YES %d %d\n", ans, last);
}
system("pause");
return 0;
}