25 lines
503 B
Python
25 lines
503 B
Python
data = []
|
|
for line in open("input"):
|
|
words = line.replace(":", "").replace(",","").split()
|
|
coords = [int(w[w.index('=')+1:]) for w in words if '=' in w]
|
|
data.append(coords)
|
|
#print(data)
|
|
|
|
none = set()
|
|
|
|
Y = 10
|
|
Y = 2000000
|
|
|
|
for sx,sy,bx,by in data:
|
|
dx = abs(sx-bx)
|
|
dy = abs(sy-by)
|
|
dist = dx+dy
|
|
y = Y-sy
|
|
for x in range(-dist,dist+1):
|
|
if abs(x)+abs(y) <= dist:
|
|
p = (sx+x, sy+y)
|
|
if p != (bx,by):
|
|
none.add(sx+x)
|
|
|
|
print(len(none))
|