HDU 5346 MZL ' s game (state design various strong)

Source: Internet
Author: User

It's amazing that this is the most powerful DP ever written in the summer (as if it had been written a few DP-like), and the state of the design is subtle.

Because the question does not know in said a yarn, and seems to write wrong, ask I-1 when there are j-1 of the living why more attack once people will rise? I didn't read it anyway. And then there's the next thing to say.

Translate it into adult speech.

Because each person waits for a probability out of any position. It may be considered orderly, that is, from 1-n a selected person. The death of the person is skipped. The final statistic of all positions is the survival rate of one person (this one seems to be easier to understand than mine =)

The state of the design is

DP[I][J] said that when I was selected, section i-n (that is, people who did not attack) had already received a J attack, which was noted.

Transfer equation

DP[I][J] = dp[i-1][j]* (n (1-p) ^j)//i-1 the probability that the person died in a J attack, that is, the first J attack was not issued by the i-1 individual but by the person in front of him, when I-1 was selected, it had received a J attack, and died in this J attack (1-the probability of not dying under J). Multiply

+ dp[i-1][j-1]* (1-p) ^ (j-1)//i-1 individuals survive j-1 attacks, that is, the first J attacks are sent by I-1.

All of the above is covered. Use inverse element to deal with P=X*INV (p)%mod

Final statistical results.

The result is that for all locations, they were selected with a K attack and were not killed in the K attack. That is Sigma (I=1->n, Dp[i][k]) * (1-p) ^k, and finally/N, because a person's probability exists at any one location

Finally, there is a very strange question ...

I.. Because on the draft: Did not write J-1, so accidentally written dp[i-1][j-1]* (1-p) ^j, the last statistic time did not * (1-p) ^k. actually AC.

So this DP should have another way of understanding? I think again = will there be a big God passing the answer?

How else can you come up with such a subtle DP? DP Slag is not puzzling.

HDU 5346 MZL ' s game (state design various strong)

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.