Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdlib>
- #include<cstdio>
- #include <algorithm>
- using namespace std;
- int main(){
- int n;
- scanf("%d", &n);
- int x1,y1,x2,y2;
- scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
- int xL=x1, xP=x2, yG=y1, yD=y2;
- for(int i=0;i<n-1;++i){
- scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
- xL=max(xL,x1);
- xP=min(xP,x2);
- yG=min(yG,y1);
- yD=max(yD,y2);
- if(xL>xP || yD>yG){
- printf("0");
- continue;
- }
- else {
- printf("%d",((xP-xL)*(yG-yD)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement