The C of Ur is SXBK.
UR2: There is a root tree divided into a bare topic, the complexity of metaphysics $O (N\sqrt{n}) $.
First, the number of multiples of the statistic K is converted.
The path of the center of gravity c is divided into two cases: (setting n is the size of the current tree)
1, in the sub-tree of C, direct O (n) calculation;
2, one in the subtree of C, the other is not, the enumeration path of the lca=p, calculated that p is not in C to the root of the current division of the path of the child's sub-tree depth is the number of multiples of each number, and then calculate the length of C children to P is the number of P multiples. Consider the algorithm compound, if the current enumeration of depth d is less than $\sqrt{h}$ so memory, or direct violence in the subtree of C to find the number of points to meet the requirements, the complexity of $o (N\sqrt{n}) $.
According to the main theorem, the total complexity of $o (N\sqrt{n}) $. Write and write in Uoj on the time rank1 ...
ur c exercises