Saleh127

UVA 737

Jul 19th, 2021
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define endl "\n"
  5. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11.  
  12. ll a,b,c,n,m,i,j,k,l,d,x,y,z;
  13.  
  14. while(cin>>n && n)
  15. {
  16. a=b=c=INT_MAX;
  17. i=j=k=INT_MIN;
  18.  
  19. while(n--)
  20. {
  21. cin>>x>>y>>z>>d;
  22.  
  23. i=max(i,x);
  24. j=max(j,y);
  25. k=max(k,z);
  26.  
  27. a=min(a,x+d);
  28. b=min(b,y+d);
  29. c=min(c,z+d);
  30. }
  31.  
  32. l=(a-i)*(b-j)*(c-k);
  33.  
  34. if(l<0) l=0;
  35.  
  36. cout<<l<<endl;
  37.  
  38. }
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment