#C637. Maximum Sub-grid Sum
Maximum Sub-grid Sum
Maximum Sub-grid Sum
You are given a grid with dimensions \(N \times M\) filled with integers. Your task is to find the maximum sum of any sub-grid of size \(P \times Q\) within this grid.
A sub-grid is defined as a contiguous block of cells, and its sum is the total of all the integers it contains. Formally, if you choose the top-left corner of a sub-grid at position \((i, j)\), then the sub-grid includes all cells \((i', j')\) where \(i \leq i' < i+P\) and \(j \leq j' < j+Q\). You need to compute the maximum sum over all such possible sub-grids.
Note: It is guaranteed that \(P \leq N\) and \(Q \leq M\).
inputFormat
The first line contains four space-separated integers: \(N\), \(M\), \(P\), and \(Q\).
The next \(N\) lines each contain \(M\) space-separated integers, representing the rows of the grid.
outputFormat
Output a single integer: the maximum sum of any sub-grid of size \(P \times Q\).
## sample4 5 2 3
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
99
</p>