比赛 20161116 评测结果 AAAAAWAAWW
题目名称 删除他们! 最终得分 70
用户昵称 残星誓言 运行时间 0.005 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2016-11-16 11:38:09
显示代码纯文本
  1. #include<iostream>
  2. #include<cstdio>
  3. using namespace std;
  4. int tot;
  5. int full;
  6. int last;
  7. int n,m,q;
  8. int main()
  9. {
  10. freopen("deleteit.in","r",stdin);
  11. freopen("deleteit.out","w",stdout);
  12. scanf("%d%d%d",&n,&m,&q);
  13. tot=n*m;
  14. full=n;last=0;
  15. for(int i=1;i<=q;i++)
  16. {
  17. int xf,yf,xs,ys;
  18. scanf("%d%d%d%d",&xf,&yf,&xs,&ys);
  19. xf++;yf++;xs++;ys++;
  20. if((xf>full&&last<ys)||xf>(full+1)) continue;
  21. if(xs>full)
  22. {
  23. tot-=(full-xf+1)*(ys-yf+1);
  24. if(last>=yf) tot-=(min(last,ys)-yf+1);
  25. }
  26. else
  27. {
  28. tot-=(xs-xf+1)*(ys-yf+1);
  29. }
  30. full=tot/m;
  31. last=tot%m;
  32. }
  33. printf("%d",tot);
  34. return 0;
  35. }