#P11504. Infinite Fry Distribution
Infinite Fry Distribution
Infinite Fry Distribution
There is an infinite line of people standing in a row (extending infinitely in both directions). Initially, P distinct persons are chosen and each is given exactly one fry. Then, in each of T rounds, every person simultaneously divides every fry they currently have into two equal halves, giving one half to the person immediately to the left and the other half to the person immediately to the right.
After T rounds, a person is considered to be satiated if the total amount of fries they have is at least L (note that L can be a non‐integer). Given the initial positions of the P people who received a fry, determine the total number of people who become satiated.
The mathematical formulation is as follows. If a person at position \(i\) initially receives one fry, after T rounds the amount of fry at position \(j\) contributed by that fry is \[ f(j-i) = \begin{cases} \binom{T}{\frac{T+(j-i)}{2}}\cdot\left(\frac{1}{2}\right)^T, & \text{if } |j-i| \le T \text{ and } T+(j-i) \text{ is even}, \\ 0, & \text{otherwise.} \end{cases} \] If the initial positions are \(p_1, p_2, \dots, p_P\), then the total fry at a given position \(x\) is \[ F(x) = \sum_{k=1}^{P} f(x-p_k). \] You are to count the number of integer positions \(x\) for which \(F(x) \ge L\).
inputFormat
The input consists of two lines.
- The first line contains three space-separated values: the integer P (the number of initially selected persons), the integer T (the number of rounds), and a real number L (the threshold for being satiated).
- The second line contains P space-separated integers representing the positions of the initially chosen persons. These positions are distinct.
outputFormat
Output a single integer: the number of people (positions) whose final amount of fries is at least L.
sample
1 1 0.25
0
2