#P4158. [SCOI2009] 粉刷匠
[SCOI2009] 粉刷匠
Description
windy has wooden boards that need to be painted. Each board is divided into cells. Each cell should be painted red or blue.
In each painting operation, windy can choose a contiguous segment of cells on a single board and paint it with one color. Each cell can be painted at most once.
If windy can paint at most times, what is the maximum number of cells he can paint correctly?
A cell is considered incorrect if it is left unpainted or painted with the wrong color.
Input Format
The first line contains three integers, , , .
Then there are lines, each containing a string of length , where 0 denotes red and 1 denotes blue.
Output Format
Output a single integer: the maximum number of cells that can be painted correctly.
3 6 3
111111
000000
001100
16
Hint
For of the testdata, , .
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号