fork download
  1. #include<stdio.h>
  2. int max(int a, int b) { if (a == -1)return b; if (a < b)return b; return a; }
  3. int min(int a, int b) { if (a == -1)return b; if (a < b)return a; return b; }
  4. int main() {
  5. int mnx, mxx, mny, mxy;
  6. mnx = mxx = mny = mxy = -1;
  7. for (int i = 0; i < 4; i++) {
  8. int x, y;
  9. scanf("%d%d", &x, &y);
  10. mnx = min(mnx, x); mxx = max(mxx, x);
  11. mny = min(mny, y); mxy = max(mxy, y);
  12. }
  13. int c = max(mxx - mnx, mxy - mny);
  14. printf("%d", c*c);
  15. return 0;
  16. }
Success #stdin #stdout 0s 4328KB
stdin
6 6 8 8
1 8 4 9
stdout
49