Compute a prefix sum matrix for the input grid to enable O(1) range sum queries.
Iterate over all possible positions where the bottom-right corner of a stamp could be placed.
For each position, use the prefix sum matrix to check if the corresponding submatrix is empty (i.e., sum is 0).
If a submatrix is empty, mark the bottom-right corner in a separate 'stamps' matrix.
Compute a prefix sum matrix for the 'stamps' matrix.
Iterate over all cells in the original grid, and for each empty cell, use the 'stamps' prefix sum matrix to check if it is covered by at least one stamp.
If any empty cell is not covered, return false. Otherwise, return true after checking all cells.