【Question】NOI2014 Ticket Purchase

  It's actually an imperfect algorithm... The A on cogs can't be dropped (the stack is burst). Thanks for the guidance of the computer room boss PPY, and now I also write it out for your reference. It should be a relatively simple one to understand.

  We first get the slope optimization equation:

  \(dp[v] = dis[v] * p[u] - dis[u] * p[u] - q[u] + dp[u] \left ( 0 <= dis[u] - dis[v] <= lim[u] \right )\)

  Then \(y = dp[v]; x = dis[v]; k = p[u]; \) All we have to do is maintain a lower convex hull to maintain the minimum b value. Now there are two difficulties in this question: First, the \(v\) point transferred to the \(u\) point must be the ancestor of u, and the distance between the two is within a certain limit. How to meet? We thought that since we need to maintain a convex hull within a certain range, we can do it with the help of data structures.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325964653&siteId=291194637