h, w = map(int, input().split()) s = [list(map(int, input().split())) for _ in range(h)] ans = [] vis = [[False for _ in range(w)] for _ in range(h)] def dfs(i, j): vis[i][j] = True directions = [(0, 1), (1, 0), (-1, 0), (0, -1)] for dx, dy in directions: nx, ny = i+dx, j+dy if not vis[h-1][w-1] and...