luogu#P9174. [COCI 2022/2023 #4] Bojanje

    ID: 8392 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划 DP2022矩阵加速状态合并COCI(克罗地亚)状压 DP

[COCI 2022/2023 #4] Bojanje

Problem Description

Oliver is a little yellow duck who can not only find bugs but also likes painting. His latest painting has nn sections, and each section is painted with a different color. After that, he received a lot of criticism because his painting was too predictable. He decided to modify his painting for tt iterations. In each iteration, he will do the following:

  1. Oliver uniformly randomly chooses an index i (1in)i\ (1\le i\le n), and then remembers the color of section ii in the painting.
  2. Oliver uniformly randomly chooses an index j (1jn)j\ (1\le j\le n). He repaints section jj to be the same color as section ii. If section jj already has the same color as section ii, then nothing changes. Note that ii may equal jj.

Now, Oliver is afraid that his painting will become too plain or boring. He thinks a painting is good if it contains at least kk different colors. Please help him compute the probability that the final painting is good.

Input Format

The first line contains three integers n,t,k (2kn10,1t1018)n,t,k\ (2\le k\le n\le 10,1\le t\le 10^{18}), with meanings as described in the statement.

Output Format

Output one number in a single line, representing the answer modulo 109+710^9+7.

Formally, let m=109+7m=10^9+7. It can be shown that the answer can be written as an irreducible fraction pq\frac{p}{q}, where pp and qq are integers and q≢0(modm)q\not\equiv 0 \pmod m. Output pq1modmp\cdot q^{-1}\bmod m. In other words, output the integer xx such that 0x<m0\le x<m and xqp(modm)x\cdot q\equiv p\pmod m.

2 1 2
500000004
10 2 5
1
3 141592653589793 2
468261332

Hint

Explanation for Sample 11: There are two colors in the painting, so after one iteration, the probability that the painting stays the same as before any operation is 12\frac{1}{2}.

Explanation for Sample 22: After two iterations, it is impossible for the number of different colors to decrease from 1010 to less than 55, so in all cases the painting will have at least 55 different colors.

Subtask ID Additional Constraints Score
00 Sample 00
11 k=nk=n 2828
22 t1000t\le 1000 3636
33 No additional constraints

Translated by ChatGPT 5