20 lines
686 B
Python
20 lines
686 B
Python
#!/usr/bin/env python3
|
|
|
|
import numpy as np
|
|
a = np.array([list(map(int,i)) for i in [list(j) for j in open("08/i").read().strip().split("\n")]])
|
|
visible = np.shape(a)[0]*2+(np.shape(a)[1]-2)*2
|
|
print(visible)
|
|
|
|
for y in range(1,np.shape(a)[0]-1):
|
|
for x in range(1,np.shape(a)[1]-1):
|
|
# Visible?
|
|
left = True if len(list(np.where(a[y][0:x]>=a[y][x])[0]))<1 else False
|
|
right = True if len(list(np.where(a[y][x:] >=a[y][x])[0][1:]))<1 else False
|
|
top = True if len(list(np.where(a[:,x][0:y]>=a[y,x])[0]))<1 else False
|
|
bottom = True if len(list(np.where(a[:,x][y:]>=a[y,x])[0][1:]))<1 else False
|
|
|
|
if left or right or top or bottom:
|
|
visible+=1
|
|
|
|
print(visible)
|