hiho week 219 register

Ended

Participants:164

Verdict:Accepted
Score:100 / 100
Submitted:2018-09-11 20:32:29

Lang:Python2

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
line = sys.stdin.readline().strip('\n')
n = int(line)
cnt = {}
for i in range(n):
    line = sys.stdin.readline().strip('\n').split()
    x,y = int(line[0])int(line[1])
    cnt[(x,y)] = 1
ans = 2000000*2000000
for k1,v1 in cnt.items():
    for k2,v2 in cnt.items():
        if k1[0] != k2[0] and k1[1] != k2[1]:
            if ((k1[0],k2[1]) in cnt) and ((k2[0],k1[1]) in cnt):
                ans = min(ansabs(k1[0] - k2[0]) * abs(k1[1] - k2[1]))
if ans == 2000000*2000000:
    print -1
else:
    print ans
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX