5 2 3 1 5 4 9
2
Consider removing exactly two elements from $A=(3,1,5,4,9)$.
* For example, if you remove the 2nd element $1$ and the 5th element $9$, the resulting sequence is $B=(3,5,4)$.
* In this case, the maximum value of $B$ is $5$ and the minimum value is $3$, so (maximum value of $B$) $-$ (minimum value of $B$) $=2$, which is the minimum possible value.6 5 1 1 1 1 1 1
0
8 3 31 43 26 6 18 36 22 13
18
{
"problem": {
"name": "Make Them Narrow",
"description": {
"content": "You are given a sequence $A$ of length $N$. Freely choose exactly $K$ elements from $A$ and remove them, then concatenate the remaining elements in their original order to form a new sequence $B$. ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc361_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a sequence $A$ of length $N$. \nFreely choose exactly $K$ elements from $A$ and remove them, then concatenate the remaining elements in their original order to form a new sequence $B$. ...",
"is_translate": false,
"language": "English"
}
]
}