5 4 1 8 8 7
2
We can turn $A$ into a non-decreasing sequence in two operations:
* Initially, $A = {4, 1, 8, 8, 7}$.
* Swap the first two elements. Now, $A = {1, 4, 8, 8, 7}$.
* Increment the last element by $1$. Now, $A = {1, 4, 8, 8, 8}$.20 8 2 9 7 4 6 7 9 7 4 7 4 4 3 6 2 3 4 4 9
62
{
"problem": {
"name": "Increment and Swap",
"description": {
"content": "We have a sequence $A$ of length $N$. On this sequence, we can perform the following two kinds of operations: * Swap two adjacent elements. * Select one element, and increment it by $1$. ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "cf17_exhibition_b"
},
"statements": [
{
"statement_type": "Markdown",
"content": "We have a sequence $A$ of length $N$.\nOn this sequence, we can perform the following two kinds of operations:\n\n* Swap two adjacent elements.\n \n* Select one element, and increment it by $1$.\n ...",
"is_translate": false,
"language": "English"
}
]
}