T1:pog loves Szh I (Hdu 5264)
Main topic:
The result of the cross-linking of AB two strings is given, and the original string is obtained.
Exercises
Not explained. Direct +2 output each time.
T2:pog loves Szh II (hdu 5265)
The main topic: give the number of N, the MoD P domain under the two number of the largest and. n<=100000
Exercises
First put all the number mod P, then we'll divide 2 classes into discussion. One type is a+b<=p-1. As long as the order is ordered, then assuming A<=b, from left to right enumeration A, then the best B is from right to left. O (N) resolved.
Another category is p<=a+b<=2*p-2. This is just as good as adding up the biggest two. The game did not consider this situation, silly, and then the tragedy of the FST. Originally played T3 when is rank 22, and then T4 seemingly no one to do, went to play the game. The result came back to find the tragedy of the Fst,rank fell to 50.
T3:pog loves Szh III (hdu 5266)
The main topic: Give a tree with 1 roots, many times asked the point [L,r] LCA. n,q<=300000
Exercises
My practice is O (Nlogn+qlognlogn). is to preprocess the multiplication array, and then build a line segment tree to hold the LCA of all points in the segment. There is a range of compatibility. The time limit opened 6s, or the water was over.
The mark is less a log, there is a nature, is [l,r] LCA equals [l,r] in the DFS sequence of the largest and smallest two points of the LCA.
Prove:
For the inquiry [L,r], we need to find a depth of the largest point y,[l,r] in the y subtree. Assuming that you have found such a Y, we just need to prove that the DFS sequence is the smallest point P and the DFS sequence is the largest point q of the LCA is Y. Because for a point x, the DFS sequence of his subtree is continuous. The DFS sequence of points other than PQ is between the DFS orders of the PQ, so they should be in the subtree of the LCA (P,Q). Then LCA (P,Q) can only be equal to Y.
So one more time. The maximum and minimum points of the interval DFS order are obtained.
T4:pog loves Szh IV (hdu 5267)
Topic: Give a tree, each time you modify the weight of a node, and then ask all the path of weights and. The weight of a path is equal to or sum of the points on the path. n,q<=10000. Time Limit 12s.
Exercises
Looks very difficult appearance, the examination time thought about 20 minutes to abandon the treatment. It is easy to think of the weight of the point can be changed to the root of the path of the weight value, so that the original two points between the weight of the path will become the weight of the two points or the same, or their LCA. The key is to think about the bitwise . You can point points without modification, as long as you have the number of 1 and 0 in the previous subtree when you calculate the answer to the root of X. To be modified is still in the study, then fill up.
Bestcoder Round #43