OI 2007 本選 3 – 最古の遺跡
n = int(input())
pillar = [tuple(map(int,input().split())) for i in range(n)]
pillar_set = set(pillar)
ans = 0
for i in range(n):
for j in range(i+1,n):
x1,y1 = pillar[i]
x2,y2 = pillar[j]
if (x2-y2+y1,y2+x2-x1) in pillar_set and (x1-y2+y1,y1+x2-x1) in pillar_set:
ans = max(ans,(x1-x2)**2 + (y1-y2)**2)
print(ans)
コメント