QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 128 MB Points totaux : 10

#11036. 旅程 [B]

Statistiques

在 Byteland 有 $n$ 座城市,编号从 1 到 $n$。这些城市由 $m$ 条双向道路连接。已知每对城市之间最多只有一条道路相连。

Byteman 最近承认他比其他城市更喜欢某些城市。更准确地说,他在编号从 1 到 $k$ 的城市中度过的时间特别愉快,因此在每次旅程中,他都会至少访问这些城市中的每一个一次。

Byteman 的旅程是一个包含 $d$ 座城市的序列,使得每对连续的城市之间都有道路相连。旅程可以从任何城市开始,也可以在任何城市结束。你的任务是计算 Byteman 在 Byteland 可以进行的本质不同的旅程数量。由于这个数字可能非常大,你只需要求出它对 $10^{9} + 9$ 取模的结果。

编写一个程序:

  • 从标准输入读取 Byteland 连接网络的描述,
  • 计算本质不同的旅程数量除以 $10^{9} + 9$ 的余数,
  • 将结果写入标准输出。

输入格式

输入的第一行包含四个整数 $n$、$m$、$k$ 和 $d$($1 \le n \le 20$,$1 \le k \le \min(n, 7)$,$1 \le d \le 1\,000\,000\,000$),用空格分隔。接下来的 $m$ 行包含 Byteland 城市之间连接的描述。每条道路的描述由两个数字 $a_{i}$、$b_{i}$($1 \le a_{i}, b_{i} \le n$,$a_{i} \neq b_{i}$)组成,用空格分隔,表示第 $i$ 条道路连接的城市编号。

输出格式

输出应包含一个整数,表示 Byteman 可以进行的本质不同的旅程数量,对 $10^{9} + 9$ 取模。

样例

输入 1

4 4 2 3
1 2
2 3
3 1
2 4

输出 1

10

说明 1

Byteman 所有可能的旅程为:

  • 1 → 2 → 1
  • 1 → 2 → 3
  • 1 → 2 → 4
  • 1 → 3 → 2
  • 2 → 1 → 2
  • 2 → 1 → 3
  • 2 → 3 → 1
  • 3 → 1 → 2
  • 3 → 2 → 1
  • 4 → 2 → 1

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.