Advertisement
kator

Untitled

Oct 16th, 2014
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<cstdlib>
  2. #include<cstdio>
  3. #include <algorithm>
  4. using namespace std;
  5. int main(){
  6. int n;
  7. scanf("%d", &n);
  8. int x1,y1,x2,y2;
  9. scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
  10. int xL=x1, xP=x2, yG=y1, yD=y2;
  11. for(int i=0;i<n-1;++i){
  12. scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
  13. xL=max(xL,x1);
  14. xP=min(xP,x2);
  15. yG=min(yG,y1);
  16. yD=max(yD,y2);
  17. if(xL>xP || yD>yG){
  18. printf("0");
  19. continue;
  20. }
  21. else {
  22. printf("%d",((xP-xL)*(yG-yD)));
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement