Approach of this problem?

i am not getting any idea about how to appraoch this , honestly

@Muskan-Gupta-598128740703036 read this explanation:

Let’s solve the problem for rectangle W×H (W≥H). Of course, we can cover all rectangle with itself for cost W. To get something smaller than W we have to leave at least one column uncovered — otherwise we pay at least sum of w over all rectangles which is at least W. This gives us an idea to use DP on rectangles to solve the problem: dp[x1][x2][y1][y2] is minimal cost to cover the rectangle [x1;x2)×[y1;y2). It is initialized by max(x2−x1,y2−y1), and we have to try not to cover every column/row. Total complexity is O(n5).

this problem is of hard level dp so if you are not able to get this problem you can leave this for now and try it sometime later.

i have read this already from codeforces

i know its div 1 D problem

but still i want more explaination if you could give

i can provide you the dp solution which uses 4d DP if you want, i guess you will understand solution by looking at that code.

ya ohk , send the code

Okk i m sending it to you.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.