5 2 1 3
3 If we choose $k = 1$ and repaint the three white squares one at a time, three uses are enough, which is optimal. Choosing $k = 2$ or greater would make it impossible to repaint Square $2$, because of the restriction that does not allow the $k$ squares to contain a blue square.
13 3 13 3 9
6 One optimal strategy is choosing $k = 2$ and using the stamp as follows: * Repaint Squares $1, 2$ red. * Repaint Squares $4, 5$ red. * Repaint Squares $5, 6$ red. * Repaint Squares $7, 8$ red. * Repaint Squares $10, 11$ red. * Repaint Squares $11, 12$ red. Note that, although the $k$ consecutive squares chosen when using the stamp cannot contain blue squares, they can contain already red squares.
5 5 5 2 1 4 3
0 If there is no white square from the beginning, we do not have to use the stamp at all.
1 0
1 $M$ may be $0$.
{
"problem": {
"name": "Stamp",
"description": {
"content": "There are $N$ squares arranged in a row from left to right. Let Square $i$ be the $i$\\-th square from the left. $M$ of those squares, Square $A_1$, $A_2$, $A_3$, $\\ldots$, $A_M$, are blue; the other",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc185_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ squares arranged in a row from left to right. Let Square $i$ be the $i$\\-th square from the left. \n$M$ of those squares, Square $A_1$, $A_2$, $A_3$, $\\ldots$, $A_M$, are blue; the other...",
"is_translate": false,
"language": "English"
}
]
}