RuiyuShen @ 2022-03-04 00:39:34
r,c = map(int,input().split())
if r == 1 and c == 1:
print(1)
exit(0)
all = {}
length = []
u = 1
for i in range(r):
list1 = input().split()
for j in range(c):
all[(i+1,j+1)] = int(list1[j])
special = 0
if c == 1:
special = 1
for i in range(r):
all[(i+1,2)] = 0
c += 1
if r == 1:
special = 1
for i in range(c):
all[(2,i+1)] = 0
r += 1
for i in range(1,r+1):
for j in range(1,c+1):
temp = {(i,j):0}
for x in range(r*c):
now = {}
for y in temp:
a,b = y[0],y[1]
if a == 1 and b == 1:
if all[(1,1)] > all[(1,2)]:
now[(1,2)] = 0
if all[(1,1)] > all[(2,1)]:
now[(2,1)] = 0
elif a == 1 and b == c:
if all[(1,c)] > all[(1,c-1)]:
now[(1,c-1)] = 0
if all[(1,c)] > all[(2,c)]:
now[(2,c)] = 0
elif a == r and b == c:
if all[(r,c)] > all[(r,c-1)]:
now[(r,c-1)] = 0
if all[(r,c)] > all[(r-1,c)]:
now[(r-1,c)] = 0
elif a == r and b == 1:
if all[(r,1)] > all[(r,2)]:
now[(r,2)] = 0
if all[(r,1)] > all[(r-1,1)]:
now[(r-1,1)] = 0
elif a == 1:
if all[(a,b)] > all[(a+1,b)]:
now[(a+1,b)] = 0
if all[(a,b)] > all[(a,b+1)]:
now[(a,b+1)] = 0
if all[(a,b)] > all[(a,b-1)]:
now[(a,b-1)] = 0
elif a == r:
if all[(a,b)] > all[(a,b+1)]:
now[(a,b+1)] = 0
if all[(a,b)] > all[(a-1,b)]:
now[(a-1,b)] = 0
if all[(a,b)] > all[(a,b-1)]:
now[(a,b-1)] = 0
elif b == 1:
if all[(a,b)] > all[(a+1,b)]:
now[(a+1,b)] = 0
if all[(a,b)] > all[(a,b+1)]:
now[(a,b+1)] = 0
if all[(a,b)] > all[(a-1,b)]:
now[(a-1,b)] = 0
elif b == c:
if all[(a,b)] > all[(a+1,b)]:
now[(a+1,b)] = 0
if all[(a,b)] > all[(a-1,b)]:
now[(a-1,b)] = 0
if all[(a,b)] > all[(a,b-1)]:
now[(a,b-1)] = 0
else:
if all[(a,b)] > all[(a+1,b)]:
now[(a+1,b)] = 0
if all[(a,b)] > all[(a,b+1)]:
now[(a,b+1)] = 0
if all[(a,b)] > all[(a-1,b)]:
now[(a-1,b)] = 0
if all[(a,b)] > all[(a,b-1)]:
now[(a,b-1)] = 0
temp = now
if temp == {}:
break
if u < x+1:
u = x+1
if special == 1:
u -= 1
print(u)
by zhenjianuo2025 @ 2022-06-05 11:07:08
我也是!