记录编号 |
351445 |
评测结果 |
AAAAAAAAAA |
题目名称 |
删除他们! |
最终得分 |
100 |
用户昵称 |
Mealy |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.002 s |
提交时间 |
2016-11-16 16:03:30 |
内存使用 |
0.31 MiB |
显示代码纯文本
- /*
-
- 2549. 删除他们!
-
- deleteit.in
-
- */
-
-
- #include <iostream>
- #include <cstdio>
-
-
- using namespace std;
-
-
- int n,m,q;
- int sx,sy,ex,ey;
-
- int res;
- int lastx,lasty;
-
-
- void Delete(int sx,int sy,int ex,int ey)
- {
- if(sx==lastx&&ex==lastx&&sy>lasty)
- {
- return;
- }
- if(sx>lastx&&ex>lastx)
- {
- return;
- }
-
-
- if(ex>=lastx&&ey>=lasty)
- {
- if(sy<=lasty)
- {
- res-=lasty-sy+1;
- }
- res-=(lastx-sx)*(ey-sy+1);
- }
- else
- {
- res-=(min(lastx,ex)-sx+1)*(ey-sy+1);
- }
-
-
-
- if(res%m==0)
- {
- lastx=res/m;
- }
- else
- {
- lastx=res/m+1;
- }
- lasty=res%m;
- if(lasty==0)
- {
- lasty=m;
- }
- // printf("%d %d %d\n",lastx,lasty,res);
- }
-
-
-
-
- void PreDo()
- {
- scanf("%d%d%d",&n,&m,&q);
-
- res=n*m;
- lastx=n;
- lasty=m;
-
- for(int i=1;i<=q;i++)
- {
-
- scanf("%d%d%d%d",&sx,&sy,&ex,&ey);
-
- sx++;
- sy++;
- ex++;
- ey++;
-
- Delete(sx,sy,ex,ey);
- }
- printf("%d\n",res);
- }
-
-
- int main()
- {
- freopen("deleteit.in","r",stdin);
- freopen("deleteit.out","w",stdout);
- PreDo();
- return 0;
- }