Find Sorted Submatrices With Maximum Element at Most K
Fix a left column, measure how far each row stays sorted and at most k, then count the blocks those widths allow.
Fix a left column, measure how far each row stays sorted and at most k, then count the blocks those widths allow.