Can the solution bellow be applied (with small modification) to the general case of N x N? (Solution in One Note).
#### BTW: use dark mode for better reading. 1816B - Grid Reconstruction
Solution
As you could ( maybe ) understand, my idea is use the fact that maximizing minimum cost path, is equivalent to maximizing all paths. Because if you maximize only a subset of paths, than is easy to show that minimum cost path changes.
Btw2: I did think about adding a "virtual" row and/or column to make matrix even by even, and saying that values of positions are 0, so the answer will (maybe?) not be affected.
link to problem: https://mirror.codeforces.com/problemset/problem/1816/B