Problem 3070 · Medium

Count Submatrices with Top-Left Element and Sum Less Than k

Every submatrix that contains the top-left cell is a prefix rectangle, so one prefix-sum table answers each corner.

Open the interactive visualisation