Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The intended solution uses a Greedy approach.
At each step, we will perform a cut on the line with the highest cost.
If you perform a horizontal cut, can you count the contribution that it adds to each row cut that comes afterward?