QOJ.ac

QOJ

時間限制: 6.0 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓

#10523. 最小全域木

统计

整数 $n, k$ が与えられます。以下の条件を満たす $n$ 頂点の無向連結グラフは何通りあるか求めてください。

  • グラフに自己ループはなく、任意の2頂点間に辺は高々1本である。
  • すべての辺の重みは $[1, k]$ の範囲の整数である。
  • グラフ内のすべての辺について、その辺を含む最小全域木が少なくとも1つ存在する。

2つのグラフが異なるとは、ある頂点の組 $(u, v)$ が存在し、一方のグラフでは $u, v$ 間に辺が存在するがもう一方では存在しない場合、または両方のグラフで $u, v$ 間に辺が存在するがその重みが異なる場合を指します。

条件を満たすグラフの個数を $998244353$ で割った余りを求めてください。

入力

各テストファイルには1つのテストデータのみが含まれます。 1行目に2つの正整数 $n$ と $k$ ($1 \le n \le 5 \times 10^4, 1 \le k \le 10$) が与えられます。

出力

条件を満たすグラフの個数を $998244353$ で割った余りを1行で出力してください。

入出力例

入出力例 1

3 1
4

入出力例 2

4 2
377

入出力例 3

235 7
928998036

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.