Approach hintTry it first, then revealHide
The time needed is the largest elevation along the chosen path. Run Dijkstra where a path costs its maximum cell, or add cells to a DSU in increasing height until the two corners are connected.
The time needed is the largest elevation along the chosen path. Run Dijkstra where a path costs its maximum cell, or add cells to a DSU in increasing height until the two corners are connected.