"Brush title" Little Star

This question I did a long time ago, but did not want to come out and then thrown away (like pressure dp in the piece), today once again come up with seniors to repeat that, finally we had some ideas.

Talk about what violence the idea, saying that violence is difficult to think of. Set DP [i] [j] [s] is a number in the tree is a subtree point i, j of the original image corresponding to the i, s i is a point in the state of the sub tree contains the corresponding picture in the range of s the number of programs.

Then write about the formula.

$ dp[i][j][s]= \sum \limits_t^{t|s=\phi} \sum \limits_{v,v\notin s}^{e(j,v)} \sum \limits_t^{t\in{son[i]}}dp[t][v][t] $

That is the complement enumeration s j and v is connected and to son i t of the transfer,

Time complexity is $ O (3 ^ nn ^ 2) $ will blow.

About the complexity of the complement is to prove that the $ 3 ^ n $.

Guess you like

Origin www.cnblogs.com/Lrefrain/p/11234363.html