[Probability DP] [Polynomial modulus] Noi2017.day1 T3 Swimming Pool

Source: Internet
Author: User
Tags modulus

F (i,j) represents the height of I, the length of the local area of J, I this row there is a barrier, the former i-1 row does not have the barrier, can select the region <=k probability

So fi,j=∑k<jfi,k∗pi−1∗q∗gi,j−k−1+∑k<jgi,k∗gi,j−k−1∗pi−1∗q f I, J =∑k < J F I, k∗p i−1∗q∗g i, j−k− 1 +∑k < J G I, k∗g I, J−k−1∗p i−1∗q f_{i,j}=\sum_{k,
where p is the probability of a lattice safe, q, for a lattice dangerous probability.
Gi,j g I, J G_{i,j} represents the I row, there is no obstacle in the area of length J, the probability of the selected area <=k
So Gi,j=∑s>ifs,k g I, J =∑s > I f S, K g_{i,j}=\sum_{s>i}f_{s,k}

It's going to take a little bit of diversion.
Can be transferred by segment, set H (i) H (i) H (i) as the answer of length I
So H (i) =∑kj=1h (i−j) ∗g (1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.