4 998244353
8 For example, when $P=(1,4,3,2)$, we initialize $X=(1,4,3,2)$ and perform operations as follows: 1. Since $X_1 \leq X_2$ but $X_2 > X_3$, the element $X_2=4$ is moved to the end, and $X$ becomes $(1,3,2,4)$. 2. $X_2=3$ is moved to the end, and $X$ becomes $(1,2,4,3)$. 3. $X_3=4$ is moved to the end, and $X$ becomes $(1,2,3,4)$. The number of times $1,2,3,4$ are moved to the end is $0,0,1,2$, respectively, so $f(P)=(0,0,1,2)$.
71 998244353
473972314
300 923223991
333532467
{
"problem": {
"name": "Procrastinate Counter",
"description": {
"content": "For a permutation $P=(P_1,P_2,\\dots,P_N)$ of $(1,2,\\dots,N)$, define a length-$N$ integer sequence $f(P)$ as follows. * Initialize an integer sequence $X$ with $X=(P_1,P_2,\\dots,P_N)$. Repeat the f",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "agc071_e"
},
"statements": [
{
"statement_type": "Markdown",
"content": "For a permutation $P=(P_1,P_2,\\dots,P_N)$ of $(1,2,\\dots,N)$, define a length-$N$ integer sequence $f(P)$ as follows.\n\n* Initialize an integer sequence $X$ with $X=(P_1,P_2,\\dots,P_N)$. Repeat the f...",
"is_translate": false,
"language": "English"
}
]
}