fork download
  1. /*
  2. TTTTTTTTT h h eeeeeeeee BBBBBBBBB aaaa dddddddd rrrrrrrr iiiiiiii X X
  3.   T h h e B B a a d d r r ii X X
  4.   T h h e B B a a d d r r ii X X
  5.   T hhhhhhhhh eeeeeeeee BBBBBBBBB aaaaaaaaaa d d rrrrrrrrr ii X
  6.   T h h e B B a a d d rr rr ii X X
  7.   T h h e B B a a d d rr rr ii X X
  8.   T h h eeeeeeeee BBBBBBBBB a a dddddddd rr rr iiiiiiii X X
  9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  10. */
  11. #include <bits/stdc++.h>
  12. using namespace std;
  13. #define ll long long
  14. #define ld long double
  15. /*
  16. - Give yourself 40 Minutes **of being stuck** before reading editorial
  17. - if you need the editorial, read it bit-by-bit and process it
  18. - code the solution once you understand it
  19. - Note down what are you doing/thinking of as you do it
  20.  */
  21. int main()
  22. {
  23. ios_base::sync_with_stdio(false);cin.tie(nullptr);
  24. int tt;cin>>tt;
  25. while(tt--)
  26. {
  27. int x1=-10000,y1=-10000,x2=10000,y2=10000;
  28. int n;cin>>n;
  29. while(n--)
  30. {
  31. int a,b,c,d;cin>>a>>b>>c>>d;
  32. x1=max(x1,a);
  33. y1=max(y1,b);
  34. x2=min(x2,c);
  35. y2=min(y2,d);
  36. }
  37. ll ans=0;
  38. if(x1<x2 && y1<y2) ans=(x2-x1)*(y2-y1);
  39. cout<<"Case #1: "<<ans<<endl;
  40. }
  41. }
  42. // "Failure is another stepping stone to greatness."
  43. // It's fine to celebrate success, but it is more important to heed the lessons of failure.
  44. //“Competition is the fuel that ignites innovation.”
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
Case #1: 400000000