407959: GYM102951 A Maximum Distance

Memory Limit:256 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Maximum Distancetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given $$$N$$$ $$$(3 \leq N \leq 5000)$$$ integer points on the coordinate plane. Find the square of the maximum Euclidean distance (aka length of the straight line) between any two of the points.

Input

The first line contains an integer $$$N$$$. The second line contains $$$N$$$ integers, the $$$x$$$-coordinates of the points: $$$x_1, x_2, \dots, x_N$$$ ($$$-1000 \leq x_i \leq 1000$$$). The third line contains $$$N$$$ integers, the $$$y$$$-coordinates of the points: $$$y_1, y_2, \dots, y_N$$$ ($$$-1000 \leq y_i \leq 1000$$$).

Output

Print one integer, the square of the maximum Euclidean distance between any two of the points.

ExampleInput
3
321 -15 -525
404 373 990
Output
1059112

加入题单

算法标签: