2022-12-08 11:44:02 +00:00
|
|
|
import sys
|
|
|
|
L = list(list(map(int,s)) for s in sys.stdin.read().splitlines())
|
|
|
|
W = len(L[0]) ; H = len(L)
|
2022-12-08 23:06:28 +00:00
|
|
|
N = 0
|
|
|
|
Q = 0
|
2022-12-08 11:44:02 +00:00
|
|
|
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)
|
2022-12-08 23:06:28 +00:00
|
|
|
Q += W + H
|
|
|
|
print(N, W*H*(W+H), Q)
|