To solve the problem, a solution can be used to solve one line (that is, the minimum number of errors with k strokes in a given line BW).
For each line, specify a list of errors for the given number of strokes k_i = [0, 1, ..., min k needed to cover i-th row]. Now we have nlists (of different sizes). To find which lines to use "k" strokes for, iteratvelly pop the kelements from the top of the list, which stroke the cover of most cells.
So, the main task is to solve the problem with a single line, and I'm not sure how :-)
C - . - ceil( (C+1)/2 ). - , . ( ) ().
, , . . :
, , , , . , , .
...