记录编号 |
351144 |
评测结果 |
AAAAAAAAAA |
题目名称 |
删除他们! |
最终得分 |
100 |
用户昵称 |
NVIDIA |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.000 s |
提交时间 |
2016-11-16 10:58:52 |
内存使用 |
0.00 MiB |
显示代码纯文本
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;int n,m,q,a[1000010],x1,x2,y1,y2,ans,xs,ys;
inline int read(){int x,f=1;char ch;while(ch=getchar(),!isdigit(ch))if(ch=='-')f=-1;x=ch-48;while(ch=getchar(),isdigit(ch))x=x*10+ch-48;return x*f;}
inline void predo(){n=read();m=read();q=read();ans=n*m;xs=n-1;ys=m-1;}
inline void vis(){xs=(ans-1)/m;ys=ans-xs*m-1;}
inline void work(){for(int i=1;i<=q;i++){x1=read();y1=read();x2=read();y2=read();
if(x1>x2)swap(x1,x2);if(y1>y2)swap(y1,y2);if(x1>xs)continue;ans-=((x2-x1+1)*(y2-y1+1));
if(x2<xs){vis();continue;}else{ans+=((x2-xs)*(y2-y1+1));
if(y1>ys){ans+=(y2-y1+1);}else if(y2<=ys)vis();else ans+=(y2-ys);vis();}}}
inline int Duru(){freopen("deleteit.in","r",stdin);freopen("deleteit.out","w",stdout);predo();work();cout<<ans<<endl;}int aa=Duru();int main(){;}