5 3 1 1 3 4 5 1 2 2 5 5 4
0 1 1 * After the first change, the integers on the balls become $2$, $1$, $3$, $4$, $5$, from left to right. Here, all the balls can be vanished by casting the spell five times. Thus, no modification is necessary. * After the second change, the integers on the balls become $2$, $5$, $3$, $4$, $5$, from left to right. In this case, at least one modification must be made. One optimal solution is to modify the integer on the fifth ball from the left to $2$, and cast the spell four times. * After the third change, the integers on the balls become $2$, $5$, $3$, $4$, $4$, from left to right. Also in this case, at least one modification must be made. One optimal solution is to modify the integer on the third ball from the left to $2$, and cast the spell three times.
4 4 4 4 4 4 4 1 3 1 1 1 2 1
0 1 2 3
10 10 8 7 2 9 10 6 6 5 5 4 8 1 6 3 6 2 7 10 9 7 9 9 2 4 8 1 1 8 7 7
1 0 1 2 2 3 3 3 3 2
{
"problem": {
"name": "Snuke and Spells",
"description": {
"content": "There are $N$ balls in a row. Initially, the $i$\\-th ball from the left has the integer $A_i$ written on it. When Snuke cast a spell, the following happens: * Let the current number of balls be $k$",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc017_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ balls in a row. Initially, the $i$\\-th ball from the left has the integer $A_i$ written on it.\nWhen Snuke cast a spell, the following happens:\n\n* Let the current number of balls be $k$...",
"is_translate": false,
"language": "English"
}
]
}