fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5.  
  6. // khoang cach giua 2 duong thang
  7. // (xb - xa) * (xb - xa) + (yb - ya)*(yb - ya)
  8. main()
  9. {
  10. int n;
  11. int X[5005], Y[5005];
  12. cin >> n;
  13. for(int i = 1 ; i <= n ; i ++)cin >> X[i];
  14. for(int i = 1 ; i <= n ; i ++)cin >> Y[i];
  15.  
  16.  
  17. int ans = -1e6;
  18. for(int i = 1 ; i <= n ; i ++)
  19. {
  20. for(int j = i + 1 ; j <= n ; j ++)
  21. {
  22. int x = X[j] - X[i];
  23. int y = Y[j] - Y[i];
  24. int toado = x * x + y * y;
  25. ans = max(ans, toado);
  26. }
  27. }
  28.  
  29. cout << ans;
  30. return 0;
  31.  
  32. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
-1000000