20 lines
442 B
Python
20 lines
442 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
|
|
Q = 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)
|
|
Q += W + H
|
|
print(N, W*H*(W+H), Q)
|