Hashcode previous problem question

Revision en1, by motatoes, 2018-02-26 11:22:13

Hello CF!

I'm preparing for the next hashcode by the following prev. problem:

Given a pizza of size R x C with cells containing either mushrooms or tomatoes as shown bellow:

We are given 2 parameters: L and H. The goal is to split the pizza into rectangular slices such that each rectangle contains at least L cells of mushrooms and at least L of tomatoes. Furthermore, each split rectangle should contain at most H cells in total. Note that not all of the pizza needs to be contained in the split. The goal is to maximize the number of cells

So in the example above, L=1 and H=6 so in this case The ideal split will be:

So each split contains at least 1 mushroom and at least 1 tomato, and each split contains at most 6 cells. I am not sure how to approach the solution to this problem? Which topics should I read about to understand how to solve such a problem?

Tags hashcode

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English motatoes 2018-02-26 14:26:16 8 Tiny change: '.com/) by the follo' -> '.com/) by solving the follo'
en1 English motatoes 2018-02-26 11:22:13 1083 Initial revision (published)