38 lines
731 B
Python
38 lines
731 B
Python
|
import sys
|
||
|
from collections import defaultdict
|
||
|
|
||
|
def mtn(P,Q):
|
||
|
(x,y) = P
|
||
|
(u,v) = Q
|
||
|
return abs(u-x)+abs(v-y)
|
||
|
|
||
|
S = list()
|
||
|
for l in sys.stdin.read().splitlines():
|
||
|
(_,_,X,Y,_,_,_,_,A,J) = l.split(" ")
|
||
|
x = int(X[2:-1])
|
||
|
y = int(Y[2:-1])
|
||
|
a = int(A[2:-1])
|
||
|
b = int(J[2:])
|
||
|
S.append((x,y,abs(x-a)+abs(y-b)))
|
||
|
|
||
|
print(S)
|
||
|
|
||
|
W = H = 4*1000*1000 #+1
|
||
|
if len(sys.argv)>1:
|
||
|
W = H = 20+1
|
||
|
|
||
|
for i in range(W):
|
||
|
print(".", end ='')
|
||
|
for j in range(H):
|
||
|
# is this point reachable by any sensor
|
||
|
r = False
|
||
|
for (x,y,db) in S:
|
||
|
dp = abs(x-i)+abs(y-j)
|
||
|
if dp <= db:
|
||
|
r = True
|
||
|
break
|
||
|
if not r:
|
||
|
print(i,j)
|
||
|
|
||
|
# taking too long
|