Check if we can cut vertically at c1 , at least one apple in matrix ( r , c ) -> R - 1 , c1
if ( preSum [ r , c ] - preSum [ r , c1 ] > 0 ) dp [ k , r , c ] += dp [ k - 1 , r , c1 ] ; } } } } } return dp [ K , 0 , 0 ] ; }