3 2 1 2 3 1 2 1 3
6 There are four ways to perform operations, as follows: * Do nothing, both in the first and second operations. The final sequence would be $1,2,3$, with the inversion number of $0$. * Do nothing in the first operation, then perform the swap in the second. The final sequence would be $3,2,1$, with the inversion number of $3$. * Perform the swap in the first operation, then do nothing in the second. The final sequence would be $2,1,3$, with the inversion number of $1$. * Perform the swap, both in the first and second operations. The final sequence would be $3,1,2$, with the inversion number of $2$. The sum of these inversion numbers, $0+3+1+2=6$, should be printed.
5 3 3 2 3 1 4 1 5 2 3 4 2
36
9 5 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8
425
{
"problem": {
"name": "Inversion Sum",
"description": {
"content": "You are given an integer sequence of length $N$: $A_1,A_2,...,A_N$. Let us perform $Q$ operations in order. The $i$\\-th operation is described by two integers $X_i$ and $Y_i$. In this operation, we wi",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 3000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc030_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given an integer sequence of length $N$: $A_1,A_2,...,A_N$. Let us perform $Q$ operations in order. The $i$\\-th operation is described by two integers $X_i$ and $Y_i$. In this operation, we wi...",
"is_translate": false,
"language": "English"
}
]
}