Help with problem understanding

here is this problem. This problem i am trying to solve for over days now and i can’t find an AC solution. i have tried difference ways, one thing i am insecure about is if sub-blocks are square or not ? though i tried both ways, i coulnd’t find a solution.

i am new to coding and very new to Dunamic Programming.

help me understand this problem well please.