比赛 |
20161116 |
评测结果 |
AAAWWWAWWW |
题目名称 |
删除他们! |
最终得分 |
40 |
用户昵称 |
Extreme°/极致 ° |
运行时间 |
0.003 s |
代码语言 |
C++ |
内存使用 |
0.29 MiB |
提交时间 |
2016-11-16 10:39:36 |
显示代码纯文本
#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;
continue;
}
}
}
}
printf("%d",count);
return 0;
}