| 记录编号 | 351416 | 评测结果 | AAAAAAAAAA | 
    
        | 题目名称 | 2549.删除他们! | 最终得分 | 100 | 
    
        | 用户昵称 |  残星誓言 | 是否通过 | 通过 | 
    
        | 代码语言 | C++ | 运行时间 | 0.003 s | 
    
        | 提交时间 | 2016-11-16 15:36:28 | 内存使用 | 0.31 MiB | 
    
    
    
    		显示代码纯文本
		
		#include<iostream>
#include<cstdio>
using namespace std;
int tot;
int full;
int last;
int n,m,q;
int main()
{	
	freopen("deleteit.in","r",stdin);
	freopen("deleteit.out","w",stdout);
	scanf("%d%d%d",&n,&m,&q);
	tot=n*m;
	full=n;last=0;
	for(int i=1;i<=q;i++)
	{
		int xf,yf,xs,ys; 
		scanf("%d%d%d%d",&xf,&yf,&xs,&ys);
		xf++;yf++;xs++;ys++;
		if((xf>full&&last<yf)||xf>(full+1)) continue;
		if(xs>full)
		{
			tot-=(full-xf+1)*(ys-yf+1);
			if(last>=yf) tot-=(min(last,ys)-yf+1);
		}
		else
		{
			tot-=(xs-xf+1)*(ys-yf+1); 
		}
		full=tot/m;
		last=tot%m;
	}
	printf("%d",tot);
	return 0;
}