#C3287. Minimum Stabilizing Cost
Minimum Stabilizing Cost
Minimum Stabilizing Cost
You are given a rectangular grid of land plots. Each plot has a stabilization cost, and your task is to determine the minimum cost required to stabilize a contiguous sub-rectangle of the grid. Note that a single plot counts as a valid sub-grid.
The answer is simply the minimum element in the grid, because any individual plot forms a valid sub-rectangle.
In mathematical notation, if \(grid[i][j]\) represents the cost at position \(i\) and \(j\), then the required answer is \(\min_{i,j} grid[i][j]\).
inputFormat
The first line of input contains two integers \(n\) and \(m\) representing the number of rows and columns respectively. This is followed by \(n\) lines, each containing \(m\) space-separated integers representing the stabilization cost of each plot in that row.
outputFormat
Output a single integer, which is the minimum stabilization cost found in the grid.
## sample3 4
2 4 1 5
3 2 7 6
4 8 3 2
1