#abc212e. E - Safety Journey

E - Safety Journey

Score : 500500 points

问题描述

在AtCoder共和国中,有NN个城市,分别称为城市1、城市2、\ldots、城市NN。最初,每一对不同的城市之间都有一条双向道路,但由于时间推移,其中有MM条道路已经无法使用。具体来说,对于每个1iM1\leq i \leq M,连接城市UiU_i和城市ViV_i的道路已变得不可用。

Takahashi将进行一场为期KK天的旅行,起点和终点都在城市1。形式上来说,一场起点和终点均为城市1的KK天旅行是一个包含K+1K+1个城市的序列(A0,A1,,AK)(A_0, A_1, \ldots, A_K),满足A0=AK=1A_0=A_K=1,并且对于每个0iK10\leq i\leq K-1AiA_iAi+1A_{i+1}不同,并且仍然存在一条可以使用的道路连接城市AiA_i和城市Ai+1A_{i+1}

请计算并输出以城市1为起点和终点的不同KK天旅行的数量,结果对998244353998244353取模。这里,两个KK天旅行(A0,A1,,AK)(A_0, A_1, \ldots, A_K)(B0,B1,,BK)(B_0, B_1, \ldots, B_K)被认为是不同的,当且仅当存在某个ii使得AiBiA_i\neq B_i

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

The Republic of AtCoder has NN cities, called City 11, City 22, \ldots, City NN. Initially, there was a bidirectional road between every pair of different cities, but MM of these roads have become unusable due to deterioration over time. More specifically, for each 1iM1\leq i \leq M, the road connecting City UiU_i and City ViV_i has become unusable.

Takahashi will go for a KK-day trip that starts and ends in City 11. Formally speaking, a KK-day trip that starts and ends in City 11 is a sequence of K+1K+1 cities (A0,A1,,AK)(A_0, A_1, \ldots, A_K) such that A0=AK=1A_0=A_K=1 holds and for each 0iK10\leq i\leq K-1, AiA_i and Ai+1A_{i+1} are different and there is still a usable road connecting City AiA_i and City Ai+1A_{i+1}.

Print the number of different KK-day trips that start and end in City 11, modulo 998244353998244353. Here, two KK-day trips (A0,A1,,AK)(A_0, A_1, \ldots, A_K) and (B0,B1,,BK)(B_0, B_1, \ldots, B_K) are said to be different when there exists an ii such that AiBiA_i\neq B_i.

Constraints

  • 2N50002 \leq N \leq 5000
  • $0 \leq M \leq \min\left( \frac{N(N-1)}{2},5000 \right)$
  • 2K50002 \leq K \leq 5000
  • 1Ui<ViN1 \leq U_i<V_i \leq N
  • All pairs (Ui,Vi)(U_i, V_i) are pairwise distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM KK

U1U_1 V1V_1

::

UMU_M VMV_M

Output

Print the answer.

Sample Input 1

3 1 4
2 3

Sample Output 1

4

There are four different trips as follows.

  • (1,2,1,2,11,2,1,2,1)
  • (1,2,1,3,11,2,1,3,1)
  • (1,3,1,2,11,3,1,2,1)
  • (1,3,1,3,11,3,1,3,1)

No other trip is valid, so we should print 44.

Sample Input 2

3 3 3
1 2
1 3
2 3

Sample Output 2

0

No road remains usable, so there is no valid trip.

Sample Input 3

5 3 100
1 2
4 5
2 3

Sample Output 3

428417047

update @ 2024/3/10 09:27:49