1. Preface
Today is the subject of APIO2010, and the main goal is still to practice the search (which, of course, says so). Feel generally still can do, the first two seems to be more suitable for cheat points.
2. Commando Special Action Team
Approximate test instructions: Given a sequence, divide it into sub-segments, requiring that each segment and x transform be the sum of the ax^2+bx+c after the maximum. (A,b,c are known, a<0)
Summary: 50 points of violence DP is still very well written, but since the constant problem may be stuck in 40 points, the main focus is on the calculation of the transformation value. The test wrote a greedy, that is, according to the nature of the two-time function, the maximum value exists in the X=-B/2A, so when the forward enumeration when the maximum value can be broken, instead of enumerating to the front. But this correctness is obviously insufficient. After I was handed over to the Codevs, I was terrified, even after 6 points all AC, but the first 4 points but WA. Witty I decided to classify the data according to the size of the discussion, the results of the evaluation only 70 points, the last 3 points all of tle. Later on his own manual test found that really t into a ghost, really worship Codevs evaluation speed AH! 2.8s of data ran out of 0.4s.
The problem: Of course, there is no 70-point algorithm. The positive solution is the slope optimization dynamic programming. "Here to add!" "
Code slightly.
3. Patrol Patrol
Probably test instructions: give a tree, even the K-bar (k∈[1,2]), so that the number of steps from the 1th node to traverse the whole map is the least.
Summary: K=1 is a good writing, you can obtain the longest chain on the tree (that is, the diameter of the tree), you can get 30 points. Then k=2 the situation, the examination room did not write, but look at the other classmates pointers feel very good, although the same can not guarantee the correctness of the greedy, but the score is much better, so after the same, think of some strange points of the way it.
Puzzle: Direct tree diameter (30 points); Find out the diameter of the tree after the chain is deleted, the diameter (greedy algorithm, 66 points); Tree DP (100 points). Why is the former only 66 points? Because the selection of two rings is to be discussed in categories, one for the two rings do not intersect, there is no heavy edge, that is, greedy can achieve; there is a common edge for two rings, but easy to
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
[Not completed] [Puzzle + Summary]20150821