Codejam 2018 Round 1A - Waffle Choppers

Link

I wanted to know the approach to this problem. Thank you.