比赛 20120722 评测结果 AAAAAAAATTTTTTTTTTTT
题目名称 切割矩形 最终得分 40
用户昵称 苏轼 运行时间 12.002 s
代码语言 C++ 内存使用 0.77 MiB
提交时间 2012-07-22 10:28:34
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int number,n,m,answer=0;
struct hehe
{
	int x1,y1,x2,y2;
}q[30002];
int main()
{
	freopen ("cutting.in","r",stdin);
	freopen ("cutting.out","w",stdout);
	scanf("%d\n",&number);
	for (int p=0;p<number;p++)
	{
		answer=0;
		cin>>n;
		for (int i=0;i<n;i++)
			scanf("%d%d%d%d\n",&q[i].x1,&q[i].y1,&q[i].x2,&q[i].y2);
		cin>>m;
		for (int i=0;i<m;i++)
		{
			int a,b,c,d;
			scanf("%d%d%d%d\n",&a,&b,&c,&d);
			for (int j=0;j<n;j++)
			{
				if (b<=q[j].y2&&b>=q[j].y1)
				{
					if (a>q[j].x2)
						continue;
					if (c<q[j].x1)
						continue;
					answer++;
				}
			}
		}
		printf("%d\n",answer);
	}
	return 0;
}