問題一覧 > 通常問題

No.1621 Sequence Inversions

レベル : / AI推定難易度 : 1800 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 73
作問者 : だれ / テスター : nok0 yuto1115
お気に入りにしたユーザー ProblemId : 6712 / 自分の提出
問題文最終更新日: 2026-04-28 14:21:35
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
問題文一行コンテスト (順位表) の他の問題:

Problem Statement

Find the number of sequences $B_1,B_2,\cdots,B_N$ obtained by rearranging $A_1,A_2,\cdots,A_N$ such that there are exactly $K$ pairs $(i, j)$ satisfying $1\leq i\lt j\leq N$ and $B_i\gt B_j$.

Input

$N$ $K$
$A_1$ $A_2$ $\ldots$ $A_N$

  • All inputs are integers.
  • $2\leq N\leq 100$
  • $0\leq K\leq \frac{N(N-1)}{2}$
  • $1\leq A_i\leq 10^9$

Output

Output the answer on a single line.

Since the answer can be very large, output the remainder when divided by $998244353$.

Sample

Sample 1
Input
4 2
1 2 2 3
Output
3

There are $3$ such sequences: $(1,3,2,2),\ (2,1,3,2),\ (2,2,1,3)$.

Sample 2
Input
2 1
1 1
Output
0

Sample 3
Input
20 100
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Output
295100981

Output the remainder when divided by $998244353$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。