3 1 3 2 1
3 2 3 1 3 1 2 In this example, the maximum number of operations is $3$. The operations in the sample output proceed as follows: * 1st operation: Choose $(l,r)=(2,3)$. We have $1 \leq 3-2$ and $P_2 > P_3$, and $(2,3)$ has not been chosen before, so the conditions are satisfied. Swap $P_2$ and $P_3$, resulting in $P=(3,1,2)$. * 2nd operation: Choose $(l,r)=(1,3)$. We have $1 \leq 3-1$ and $P_1 > P_3$, and $(1,3)$ has not been chosen before, so the conditions are satisfied. Swap $P_1$ and $P_3$, resulting in $P=(2,1,3)$. * 3rd operation: Choose $(l,r)=(1,2)$. We have $1 \leq 2-1$ and $P_1 > P_2$, and $(1,2)$ has not been chosen before, so the conditions are satisfied. Swap $P_1$ and $P_2$, resulting in $P=(1,2,3)$.
5 4 1 4 3 2 5
0
4 2 4 1 2 3
2 1 4 1 3
10 5 8 7 6 10 9 3 1 5 2 4
15 3 8 2 8 3 10 3 9 1 8 2 10 2 9 2 7 1 10 5 10 1 9 4 10 4 9 1 7 1 6
{
"problem": {
"name": "Improve Inversions",
"description": {
"content": "You are given a permutation $P=(P_1,P_2,\\cdots,P_N)$ of $(1,2,\\cdots,N)$. Additionally, you are given an integer $K$. You can perform the following operation zero or more times: * Choose integers $",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc180_b"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a permutation $P=(P_1,P_2,\\cdots,P_N)$ of $(1,2,\\cdots,N)$. Additionally, you are given an integer $K$.\nYou can perform the following operation zero or more times:\n\n* Choose integers $...",
"is_translate": false,
"language": "English"
}
]
}