360 pen questions

There is a need to build cities, to give you the coordinates of N houses X, Y, and asked to so many houses are all packed into the city, then, is how much the minimum required area of ​​the city (note city square parallel to the axis)


Enter a description:
The first row N, the number of houses (2≤N≤1000)

Output Description:
The minimum area required for city

Input example 1:
2
0 0
2 2

Output Example 1:
4

Input Example 2:
2
0 0
0 3
 
 
Output Example 2:
9

# -*- coding:utf-8 -*-
import sys
n=int(sys.stdin.readline().strip().split()[0])
x_zhou=[]
y_zhou=[]
for i in range (n):
    x_y_zhou=sys.stdin.readline().strip().split()
    x_zhou.append(int(x_y_zhou[0]))
    y_zhou.append(int(x_y_zhou[1]))
x_max=max(x_zhou)
x_min=min(x_zhou)
y_max=max(y_zhou)
y_min=min(y_zhou)
x_use=x_max-x_min
y_use=y_max-y_min
answer=max(x_use,y_use)
result=answer*answer
print(result)

 

Guess you like

Origin www.cnblogs.com/yangyang1989/p/11403991.html