問題一覧 > 通常問題

No.997 Jumping Kangaroo

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 256 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 102
作問者 : ganmodokix / テスター : monkukui2
お気に入りにしたユーザー ProblemId : 3559 / 自分の提出
問題文最終更新日: 2020-02-22 00:25:32
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 238 (順位表) の他の問題:

Problem Statement

Ganmo the kangaroo is trying to cross a row of rocks from one end to the other by jumping.

There are $WK+1$ rocks placed at equal intervals in a row, numbered $0, 1, 2, \cdots\ , WK$ from left to right. All rocks whose numbers are multiples of $W$ are white. Ganmo has currently landed on rock $0$ and wants to cross to rock $WK$.

From the rock he is currently on, Ganmo can move to a rock whose number is larger by $A_1, A_2, \cdots, A_N$. That is, when he is on rock $i$, he can choose any integer $1\le j \le N$, jump, and land on rock $i+A_j$. He cannot jump toward a smaller number.

However, Ganmo has decided not to jump over $2$ white rocks in a row. That is, for every integer $0\le i \lt K$, if he does not land on rock $iW$, he must land on rock $(i+1)W$.

Find the number of ways to jump from rock $0$ to rock $WK$ in the manner described above, modulo $10^9+7$. Two ways of jumping are considered different if there exists a rock that is landed on in one way but not in the other.

Input

$N\ W\ K$
$A_1\ A_2\ \cdots\ A_N$

The input satisfies the following constraints.

  • All inputs are integers
  • $1 \le W \le 40$
  • $1 \le N \le 2W$
  • $1 \le A_i \le 2W$
  • If $i\ne j$, then $A_i \ne A_j$
  • $1 \le K \le 10^{18}$

Output

Output the number of ways to jump modulo $10^9+7$, followed by a newline.

Sample

Sample 1
Input
2 4 1
1 2
Output
5

The ways of jumping are the following 5:
$0 \to 1 \to 2 \to 3 \to 4$
$0 \to 2 \to 3 \to 4$
$0 \to 1 \to 3 \to 4$
$0 \to 1 \to 2 \to 4$
$0 \to 2 \to 4$
.

Sample 2
Input
2 5 1
1 2
Output
8

Sample 3
Input
5 40 31415926535
2 3 5 7 11
Output
320973216

Note that the output is the remainder modulo $10^9+7$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。