3 4 7 5 5 1 5 2 6 1 7 3 5
0
1
2
2
The first query changes the sequence to $(5, 5, 5)$. Here, we have $f(n) = 0$ for any $n$, so the answer is $0$.
The second query changes the sequence to $(5, 6, 5)$. Here, one possible way to do the operations is as follows.
* Choose $(i,j,x) = (3,2,0.4)$, changing the sequence to $(5, 5.6, 5.4)$ and gaining $0.4$ points.
* Choose $(i,j,x) = (1,2,0.3)$, changing the sequence to $(5.3, 5.3, 5.4)$ and gaining $0.3$ points.
The above two operations gain $0.7$ points, from which we can see that $f(2) \geq 0.7$.
We can prove that it is impossible to gain more than $1$ point in total, and that the total number of points that can be gained by the optimal way to do the operations tends to $1$ as the number of operations increases. Thus, we have $\displaystyle \lim_{n\to\infty} f(n) = 1$.2 4 1 2 2 5 1 3 1 2 2 3
2 1 499122178 499122177
{
"problem": {
"name": "Infinite Operations",
"description": {
"content": "Given are a sequence of $N$ positive integers $A = (A_1, A_2, \\ldots, A_N)$ and $Q$ queries. The $i$\\-th query is as follows: * given integers $x_i$ and $y_i$ (where $1\\leq x_i\\leq N$), change $A_{",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 5000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc126_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "Given are a sequence of $N$ positive integers $A = (A_1, A_2, \\ldots, A_N)$ and $Q$ queries. The $i$\\-th query is as follows:\n\n* given integers $x_i$ and $y_i$ (where $1\\leq x_i\\leq N$), change $A_{...",
"is_translate": false,
"language": "English"
}
]
}