Mar 27, 2021 Gym102798E So many possibilities
The first time I saw this question, I mistakenly considered that the probability of each situation was equal. In fact, each step the operater makes may have different probability.
However, when I got to find my method was wrong, confusion sprang to my mind. How to solve it?
Consider using probability dynamic programing. Once we know who have died, we reach the number of operations. Actually, the order doesn’t affect the answer, because all the killed ones only add one more contribution.
Another strange thing to pay attention to is the range of “N”. 15?? We immediately come up with the state-compressed dynamic programing. So the key to the solution is clear now. But how to achieve the algorithm?
We define as using i steps to achieve S, each staying alive. Similarly, we define , while all mean living ones and all mean killed ones. represents the summation of all the killed’s HPs and stands for the number of deaths.
If we finished i steps and intend to perform the next one, we will have two two different results :
(Attention : Must be aware of the meaning of ""
We are not to kill anyone, then
We killed a entourage , which means of the previous steps should be targeted on it. Ok,
So,
The most essential and difficult part of all the process is to understand that the previous results have already caculated the steps made by the livings. We don’t need to do it twice.