BZOJ1017[JSOI2008] Warcraft Map DOTR

Source: Internet
Author: User

Occupy a pit first.

The puzzle is written, the code does not want to write.

Bzoj 1017 DP Derivation, no code. (I'm not going to tell you it's my code won't write it) first we can see that this is a tree DP but different from the usual tree DP which is merged by the son node to the parent node. Set F[i][j][k] Represents a subtree with I as the Root contributing J to his father node, the largest power we can get from K is divided into two states. I is the leaf node: f[i][j][k*cost[i]]= (K-J) *power ([i]); K*cost[i] means that at this point, the power of the point is not included in the second half of what is given to his father. I am not a leaf node: This transfer is quite strange. We need to set an intermediate array g[i][j] to indicate that the first I node in the subtree with the root of X takes the maximum power that J can get G[cnt][j]=max{g[cnt-1][k]+f[x ' son][l*res][j-k]}; This place is very difficult to understand. Split Line (explanation) CNT is the variable of the enumeration, which means that we have enumerated to the first point. First we from the large to the small enumeration L, the X this point to buy L, G[cnt-1][k] represents the previous state f[x ' son][l*res][j-k] in the res represents the point of the remaining quantity can be purchased, [J-k] is two differential value End We can further deduce ff[x][j][k]=max{g[size[x]][k]+ (L-J) *power[x] According to this G; Note: The cost of the price is the same, the composition does not need to be spent. So at the end of each root node running on one side ans array can be, the same method as above. Ans[cnt][j]=max{ans[cnt-1][k]+f[x][tmp (0<=tmp<=limit[x])][j-k]};

BZOJ1017[JSOI2008] Warcraft Map DOTR

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.