#P6239. [JXOI2012] 奇怪的道路

    ID: 5230 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp2012各省省选O2优化状态压缩,状压

[JXOI2012] 奇怪的道路

Description

Xiaoyu learned from a history book about an ancient civilization. This civilization was highly developed in every aspect, including transportation. Archaeologists already know that, at its peak, the civilization had nn cities, numbered 1,2,...,n1,2,...,n. There were mm roads connecting these cities. Each road connects two cities, making it convenient for residents to travel between them. There may be multiple roads between the same pair of cities.

According to historical records, the transportation network of this civilization satisfied two strange properties.

  1. This civilization worshipped the number kk. For any road, suppose the two cities it connects are uu and vv. Then it must satisfy 1uvk1 \le \left\vert {u-v}\right\vert \le k.
  2. Every city is connected to exactly an even number of roads (and 00 is also considered even).

However, because so much time has passed, we can no longer know the exact transportation network. Xiaoyu is very curious about how many possible ways these nn cities could be connected, so she asks you for help.

Two possible connection methods are different if and only if there exists a pair of cities such that the number of roads between them is different in the two methods.

In the transportation network, it is possible that some cities cannot reach each other.

The number of methods may be very large. You only need to output the result modulo 109+710^9 + 7.

Input Format

The input consists of one line with three integers n,m,kn,m,k.

Output Format

Output one integer, the number of valid methods modulo 109+710^9 + 7.

3 4 1
3
4 3 3
4

Hint

Constraints

  • For 100%100\% of the testdata, 1n,m301 \le n,m \le 30, 1k81 \le k \le 8.

Translated by ChatGPT 5