Painting
Time limit1sMemory limit1024 MB
Given n parts with distinct colours and t random repaint steps, find the probability that at least k colours remain, modulo 1000000007.
- Level
Medium6 of 10
- Topics
- Probability, Matrix, Math
- Solved
- No attempts yet
Problem
Oliver is a rubber duck that not only finds bugs but also likes to paint. His latest painting has parts, each coloured with a unique colour. After receiving many critiques that his painting is too predictable, he decided to modify it in iterations. In every iteration he does the following steps:
- Oliver selects an index () uniformly at random and memorizes the colour of the -th part.
- Oliver then selects an index () uniformly at random and repaints the -th part with the colour of the -th part. If the -th part already has that colour, nothing changes. Note that can be equal to .
Oliver is afraid his painting will become monotonous or boring. He considers a painting good if it has at least different colours. Calculate the probability that his painting is good at the end.
Input
The first line contains the numbers from the task statement , and (, ).
Output
Print the answer modulo .
Formally, let . It can be shown that the answer can be expressed as an irreducible fraction , where and are integers and . Output the integer equal to . In other words, output the integer with such that .
Hint
Clarification of the first example: The painting has two colours, so the probability that it stays the same after one iteration is .
Clarification of the second example: After two iterations, the number of different colours cannot drop from 10 to less than 5, so in every case the painting has at least 5 different colours.