No.2347 Swap!!
問題文最終更新日: 2023-06-09 20:21:53
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 392
(順位表)
の他の問題:
Problem Statement
For sequences $p,q$, define $d(p,q)$ as "the minimum number of operations needed to make $p$ equal to $q$ by repeatedly performing the operation of swapping adjacent elements of $p$ (or $0$ if this is impossible)".
Find the sum of $d(a,b)$ over all pairs $(a,b)$ of sequences of length $N$ consisting of integers between $1$ and $M$, inclusive, modulo $998244353$.
Input
$N$ $M$
- $1 \le N,M \le 10^5$
- All inputs are integers.
Output
Output the answer.
Sample
Sample 1
Input
2 2
Output
2
For $(a,b)=((0,1),(1,0)),((1,0),(0,1))$, we have $d(a,b)=1$. In all other cases it is $0$, so the answer is $2$.
Sample 2
Input
1 2
Output
0
Sample 3
Input
314 159
Output
691219959
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Forested
ぷら