题解 | #滑雪#
滑雪
https://www.nowcoder.com/practice/36d613e0d7c84a9ba3af3ab0047a35e0
def dfs(i,j,length): global long long = max(long, length) for nx,ny in [(1,0),(0,1),(-1,0),(0,-1)]: x = i+nx y = j+ny if 0<=x<r and 0<=y<c and g[x][y]<g[i][j] and not tag[x][y]: tag[x][y]=True dfs(x,y,length+1) tag[x][y]=False r,c = list(map(int,input().split())) g=[] for i in range(r): g.append(list(map(int,input().split()))) long=0 for i in range(r): for j in range(c): tag = [[False]*c for _ in range(r)] tag[i][j]=True dfs(i,j,1) print(long)