BZOJ 3277 & BZOJ 3473 series string (generalized suffix automaton, time complexity analysis, heuristic combined merged segment tree, tree Chairman)

Label so long is because the practice too much. . .

Topic links: (bzoj 3277) https://www.lydsy.com/JudgeOnline/problem.php?id=3277

(bzoj 3473) https://www.lydsy.com/JudgeOnline/problem.php?id=3473

answer:

A common practice to talk about the three parts: construction of a generalized SAM, then obtained for each point it appeared in a number of string.

A practice

Each string of violence in the run broadly SAM. Each point of violence ran jump up along the tree fail, skip mark point marked up until the jump point (each string is incumbent with different labels).

Time complexity \ (O (L \ sqrt L) \) ( \ (n-\) is the number of strings, \ (L \) is the total length)

Write about the time complexity analysis: (I think, is probably wrong, wrong urge chiefs pointed out that thanks !!)

Assume that the string length \ (X \) , then in the worst case it has depth to go, and each step has been skipped points not encountered, the number of steps which in this case taking the \ (\ SUM _ ^ {X} = {I}. 1 I = O (X ^ 2) \) .

But it is also subject to other restrictions, a few steps away is the SAM does not exceed the total size \ (O (L) \) . Therefore, the time complexity of its contribution to the \ (O (\ min (x ^ 2), L) \) .

Time complexity to calculate worst case, i.e. the known \ (\ SUM _ ^ {m} = {I}. 1 x_i = L \) , seeking \ (\ sum ^ {m} _ {i = 1} \ min (x_i ^ 2, L) \) maximum. Obviously when \ (x_i> \ sqrt L \ ) when there is no sense (wasted cost value does not increase), it is known that \ (\ sum ^ {m} _ {i = 1} x_i = L \) and for any \ (I \) have \ (I \ Le \ sqrt L \) , seeking \ (\ sum ^ {m} _ {i = 1} x_i ^ 2 \) maximum. Obviously (or partial derivatives can also be used to explain, if you like ...) by the unevenness of the known functions of all long strings are \ (\ sqrt L \) the maximum objective function is \ (O (L \ sqrt L ) \) .

Practice two

Similar BZOJ2754 / BZOJ2780, the problem is that the number of colors, each set recorded dot open through this point all the strings, and then along the bottom up Parent heuristic merge tree. Time complexity \ (O (n-\ log ^ 2N) \) .

Segment tree merger seems to be able to do \ (O (the n-\ the n-log) \) ?

Practice three

Still the number of colors you can use DFS order + Chairman trees and other magical practices to solve. Time complexity \ (O (the n-\ log ^ 2n) \) (?)

Code

A practice

Because we do not find BZOJ collapse, abandoned pit to be filled.

Guess you like

Origin www.cnblogs.com/suncongbo/p/11073773.html