{"problem":{"name":"Sort A[i]-i","description":{"content":"You are given positive integers $N$ and $M$. Here, $N<M$. A sequence of $N$ non-negative integers $a=(a_1,a_2,\\cdots,a_N)$ is said to be a **good** sequence when it satisfies the following condition: ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":5000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"wtf22_day1_e"},"statements":[{"statement_type":"Markdown","content":"You are given positive integers $N$ and $M$. Here, $N<M$.\nA sequence of $N$ non-negative integers $a=(a_1,a_2,\\cdots,a_N)$ is said to be a **good** sequence when it satisfies the following condition:\n\n*   $0 \\leq a_1 \\leq a_2 \\leq \\cdots \\leq a_N \\leq M$.\n\nFor a good sequence $a$, let $f(a)$ be the sequence resulting from sorting $(a_1-1,a_2-2,\\cdots,a_N-N)$ in ascending order.\nFor each $k=1,2,\\cdots,N$, solve the following problem.\n\n*   Assume that we have found the $k$\\-th element of $f(a)$ for every possible good sequence $a$. Find the sum, modulo $998244353$, of these values.\n\n※ The answer should be between $0$ and $998244352$ even if the sum is negative.\n\n## Constraints\n\n*   $1 \\leq N < M \\leq 10^6$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"wtf22_day1_e","tags":[],"sample_group":[["2 3","998244349\n4\n\nHere are all possible $a$ and the corresponding $f(a)$.\n\n*   $a=(0,0)$: $f(a)=(-2,-1)$\n*   $a=(0,1)$: $f(a)=(-1,-1)$\n*   $a=(0,2)$: $f(a)=(-1,0)$\n*   $a=(0,3)$: $f(a)=(-1,1)$\n*   $a=(1,1)$: $f(a)=(-1,0)$\n*   $a=(1,2)$: $f(a)=(0,0)$\n*   $a=(1,3)$: $f(a)=(0,1)$\n*   $a=(2,2)$: $f(a)=(0,1)$\n*   $a=(2,3)$: $f(a)=(1,1)$\n*   $a=(3,3)$: $f(a)=(1,2)$\n\nThus, the sum of the first elements is $-4$, and the sum of the second elements is $4$."],["3 4","998244329\n0\n24"],["4 6","998244233\n35\n175\n330"],["10 1000000","297189103\n747015740\n88545731\n123651717\n920498165\n977169022\n775771117\n810877103\n152407094\n602233731"]],"created_at":"2026-03-03 11:01:13"}}