#K15061. Days to Submerge
Days to Submerge
Days to Submerge
A continent is represented by an M×N matrix where each cell contains an integer representing its elevation. The water level rises by $1$ unit per day. The continent is completely submerged when the water level reaches or exceeds the maximum elevation among all cells.
Given the grid, determine the number of days required for the entire continent to be submerged. Essentially, you need to find the maximum value in the matrix.
inputFormat
The first line contains two integers $M$ and $N$, representing the number of rows and columns in the matrix, respectively.
Each of the following $M$ lines contains $N$ space-separated integers denoting the elevations of the continent.
outputFormat
Output a single integer indicating the number of days required for the entire continent to be submerged.
## sample3 3
4 3 2
3 2 1
2 1 0
4