I coded a solution for z-rectangle which is really wrong but passed, and i bet 100 bucks that it is the official solution (well...). It fails with input 11 13. My algorithm gives 8.
Right answer is: 6
Here is the example with 6 squares in a lovely ASCII art.
AAAACCCCFFFFF
AAAACCCCFFFFF
AAAACCCCFFFFF
AAAACCCCFFFFF
BBBBBBBDFFFFF
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
Maybe we can change a little bit the task statement so that the old solution solves the new problem (like 'when you cut you go from one edge to the opposite one; you can't stop in the middle' or something like this, the less obvious the better XD).
Thanks a lot. Bye bye!
Right answer is: 6
Here is the example with 6 squares in a lovely ASCII art.
AAAACCCCFFFFF
AAAACCCCFFFFF
AAAACCCCFFFFF
AAAACCCCFFFFF
BBBBBBBDFFFFF
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
BBBBBBBEEEEEE
Maybe we can change a little bit the task statement so that the old solution solves the new problem (like 'when you cut you go from one edge to the opposite one; you can't stop in the middle' or something like this, the less obvious the better XD).
Thanks a lot. Bye bye!