Provincial election simulation for four - Q18 solution

T1

Consider then build the parent tree len is the length of the LCP at lca two strings

Lct maintenance with the largest endpos, Fenwick tree maintenance maximum

Offline scanning line to

T2

Set F [x] x is representative of sub-trees so that the size of the minimum cost <= n / 2 of

How many g [x] represents the cut remaining after

Dp is obtained in a simple tree root after 1

Dp when considered for obtaining the root to root when the son son dfs for each point to its f and g

Pretreatment prefix and half of what you can do log

T3

Consider after the first 2 to determine for each ring search

Guess you like

Origin www.cnblogs.com/AthosD/p/12513720.html