记录编号 351382 评测结果 AAAAAAAAAA
题目名称 删除他们! 最终得分 100
用户昵称 GravatarExtreme°/极致 ° 是否通过 通过
代码语言 C++ 运行时间 0.043 s
提交时间 2016-11-16 15:06:26 内存使用 0.26 MiB
显示代码纯文本
#include<cstdio>
int n,m,q;
int main()
{
	freopen("deleteit.in","r",stdin);
	freopen("deleteit.out","w",stdout);
	scanf("%d%d%d",&n,&m,&q);
	int count=n*m;
	int x1,y1,x2,y2;
	int x,y,t1,t2;
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		x1++;x2++;y1++;y2++;
		if(count%m==0)
		{
			x=count/m;
			if(x1>x)
				continue;
			else
				{
					if(x2<=x)
					{
						count-=(x2-x1+1)*(y2-y1+1);
						continue;
					}
					else
					{
						count-=(x-x1+1)*(y2-y1+1);
						continue;
					}
				}
		}
		else
		{
			x=count/m;y=count%m;
			if(x1>x)
				{
					if(x1==x+1)
					{
						if(y1>y)
							continue;
						if(y2<=y)
							{
								count-=(y2-y1+1);
								continue;
							}
						if(y2>y)
							{
								count-=(y-y1+1);
								continue;
							}
					}
					else
						continue;
				}
			else
				{
					if(x2<=x)
					{
						count-=(x2-x1+1)*(y2-y1+1);
						continue;
					}
					else
					{
						
						count-=(x-x1+1)*(y2-y1+1);
						if(y2>=y&&y1<=y)
						{
							count-=(y-y1+1);
							continue;
						}
						if(y2<=y)
						{
							count-=(y2-y1+1);
							continue;
						}
						continue;
					}
				}
		}
	}
	printf("%d",count);
	return 0;
}