#P3758. [TJOI2017] 可乐

    ID: 1369 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2017倍增各省省选矩阵加速,矩阵优化概率论,统计天津

[TJOI2017] 可乐

Description

The people on the planet Jialidun (pinyin) love drinking cola. Therefore, their enemy planet developed a cola robot and placed it in city 11 of planet Jialidun. This cola robot has three possible actions: stay where it is, go to an adjacent city, or self-destruct. Every second, it randomly triggers one of these actions. Given the city graph of planet Jialidun, and that at time 00 the cola robot is in city 11, after tt seconds, how many behavior sequences could the cola robot have?

Input Format

The first line contains two positive integers NN, MM. NN is the number of cities, and MM is the number of roads. Then MM lines follow, each containing two integers uu, vv, indicating there is a road between uu and vv. There is at most one road between any pair of cities, and no road connects a city to itself. The last line contains an integer tt, the elapsed time.

Output Format

Output the number of behavior sequences of the cola robot. Since the answer can be large, output the result modulo 20172017.

3 2
1 2
2 3
2
8

Hint

Sample Input/Output 1 Explanation

  • 11 -> self-destructs.
  • 11 -> 11 -> self-destructs.
  • 11 -> 22 -> self-destructs.
  • 11 -> 11 -> 11.
  • 11 -> 11 -> 22.
  • 11 -> 22 -> 11.
  • 11 -> 22 -> 22.
  • 11 -> 22 -> 33.

Constraints

  • For 20%20\% of the testdata, t1000t \leq 1000.
  • For 100%100\% of the testdata, 1<t1061 < t \leq 10^6, 1N301 \leq N \leq 30, 0<M<1000 < M < 100, 1u,vN1 \leq u, v \leq N.

Translated by ChatGPT 5