30 lines
778 B
Python
30 lines
778 B
Python
![]() |
#!/usr/bin/env python
|
||
|
|
||
|
|
||
|
def read_input():
|
||
|
result = []
|
||
|
with open('input.txt', 'r') as f:
|
||
|
for line in f:
|
||
|
result.append([ int(x) for x in line.split(', ')])
|
||
|
return result
|
||
|
|
||
|
MARGIN=10000
|
||
|
coord = read_input()
|
||
|
coord_min = [ min([x[0] for x in coord]), min([x[1] for x in coord]) ]
|
||
|
coord_max = [ max([x[0] for x in coord]), max([x[1] for x in coord]) ]
|
||
|
|
||
|
area_size = 0
|
||
|
for x in range(coord_max[0]-MARGIN-1, coord_min[0]+MARGIN+1):
|
||
|
for y in range(coord_max[1]-MARGIN-1, coord_min[1]+MARGIN+1):
|
||
|
|
||
|
d_total = 0
|
||
|
for loc in coord:
|
||
|
if d_total >= MARGIN:
|
||
|
break
|
||
|
d_total = d_total + abs(x - loc[0]) + abs(y - loc[1])
|
||
|
else:
|
||
|
if d_total < MARGIN:
|
||
|
area_size += 1
|
||
|
|
||
|
print(area_size)
|