fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x1,y1,x2,y2,x3,y3,x4,y4;
  6. cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
  7. vector<int>v,v1;
  8. v.push_back(x1);
  9. v.push_back(x2);
  10. v.push_back(x3);
  11. v.push_back(x4);
  12.  
  13. v1.push_back(y1);
  14. v1.push_back(y2);
  15. v1.push_back(y3);
  16. v1.push_back(y4);
  17.  
  18. sort(v.begin(), v.end());
  19. sort(v1.begin(), v1.end());
  20. int ans = max(v[3]-v[0],v1[3]-v1[0]);
  21. cout<<ans*ans;
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5320KB
stdin
6 6 8 8
1 8 4 9
stdout
49