18 lines
412 B
Python
18 lines
412 B
Python
import sys
|
|
L = list(list(map(int,s)) for s in sys.stdin.read().splitlines())
|
|
W = len(L[0]) ; H = len(L)
|
|
N=0
|
|
for i in range(H):
|
|
for j in range(W):
|
|
v = L[i][j]
|
|
# look right
|
|
r = all(L[i][k]<v for k in range(j+1, W))
|
|
# look left
|
|
l = all(L[i][k]<v for k in range(j))
|
|
# look up
|
|
u = all(L[k][j]<v for k in range(i))
|
|
# look down
|
|
d = all(L[k][j]<v for k in range(i+1,H))
|
|
N += (r|l|u|d)
|
|
print(N, W*H)
|