UOJ449. [2018] Team job feeding pigeons [probability desired, min-max-repellent capacity, generating function]

UOJ

Thinking

Due to the convention (in fact lazy) do not write code to develop recently, the following equation does not guarantee correctness.

Let's throw up a min-max inclusion and exclusion. Because each pigeon is the same, only contributed \ (O (n) \) complexity.

For now transformed into the \ (n-\) pigeons inside \ (C \) pigeons, wherein a pigeon feed seeking a desired time.

We differential equation for the desired look into statistics through \ (i \) after the second \ (c \) pigeons still have not been fed a probability.

Enumeration This \ (I \) seconds inside \ (S \) s fed to, provided \ (f_ {c, s} \) represents a \ (C \) pigeons fed \ (S \) grain corn, a probability are not full, we obtain
\ [ans_c = \ sum_i \ sum_ {s = 0} ^ i {i \ choose s} (\ frac {nc} n) ^ {is} f_ {c, s} \ ]
(in the formula \ ((\ frac {c} {n}) ^ s \) is stuffed \ (f_ {c, s} \) inside)

Because of \ (s> c (k- 1) \) when \ (F \) bound to 0, can be obtained
\ [ans_c = \ sum_ {s = 0} ^ {c (k-1)} f_ {c , s} \ sum_i {i +
s \ choose s} (\ frac {nc} {n}) ^ i \] behind it a like \ (\ frac 1 {(1 -x) ^ {s + 1} } \) expandable, can be obtained quickly, so the problem is converted to seek \ (F_ {C, S} \) .

We have a violent expression of DP:
\ [F_ {C, S} = \ sum_ {I <F_ {K}. 1-C, Si {S} \} the Choose I \ I ^ n-FRAC. 1 {} \]
Obviously It can be converted into a convoluted form with NTT optimization, and finally overall complexity \ (O (n-2K ^ \ log K) \) .

We also have another approach. The Probability into several programs, we set \ (f_ {c, s} \) represents a \ (C \) pigeons fed \ (S \) grains of maize, a number of programs are not in full. Then set \ (f_c (x) \) represents the index generating function of this thing.

Easily found, seeking \ (f_c (x) \) in fact is equivalent to finding \ ((\ sum_ {I} = 0 ^ K \ ^ X FRAC {I} {I!}) ^ C \) .

Then is a magical operation:

(Barley daklqw)

So it \ (O (n ^ 2k) \) done.

Code

Gugu Gu

Guess you like

Origin www.cnblogs.com/p-b-p-b/p/11614314.html