m columns. Each cell on the grid has a height with the height of cell. . Christina does not know which cell she started in, but she does know one thing: she is very small, especially when it comes to climbing mountains. Therefore, she can only move to a cell that is no higher than the one she is currently on and that is adjacent to her current cell. When Christina moves between two cells of the same height, she expends no energy. Otherwise, each move she makes expends. Now Christina wants to know, for all possible starting positions, what is the maximum energy she would expend?Two cells are considered adjacent if they share an edge.
Christina finds herself on a grid with n n rows and m m columns. Each cell on the grid has a height with the height of cell (i,j) (i,j) being h_{i,j} h i,j . Christina does not know which cell she started in, but she does know one thing: she is very small, especially when it comes to climbing mountains. Therefore, she can only move to a cell that is no higher than the one she is currently on and that is adjacent to her current cell. When Christina moves between two cells of the same height, she expends no energy. Otherwise, each move she makes expends 1 1 unit of energy. Now Christina wants to know, for all possible starting positions, what is the maximum energy she would expend? Two cells are considered adjacent if they share an edge. Note: Christina must never be allowed to move off the grid at any time.