Rehabilitation

June 29,

Comet OJ #6 D

Comet OJ #6 D

Meaning of the questions: tree (n \ le 100000) $ points given a $ n. Put pieces on at least two points, each round will be all the pieces toward the father, the presence of the end pieces overlap. Q. All $ 2 ^ n - n - 1 $ initial rounds and the number of chess, for $ 998,244,353 $ modulo.

Analysis: calculated after the same position BFS order, for $ T $ rounds proceeds to necessarily be classified into a continuous period.

$$ \ begin {aligned} \ sum_ {S} \ text {S number of rounds which can be performed} & = \ sum_S \ sum_ {T \ ge 0} [\ text {S T can be performed over rounds}] \\ & = \ sum_ {T \ ge 0} \ sum_S [\ text {S T can be more than two rounds}] \ end {aligned} $$

With disjoint-set sequence BFS and maintain statistical answer. The remaining question is determined for each position in BFS order when combined with the next paragraph: find the current point and the next point of LCA same depth (i.e., the next sequence BFS), the subtraction can be judged dep the combined rounds.

Think a

Refinement understand how the transformation of the demand amount, which is the Abel sum formula.

I can adapt this question: Given a tree of $ n (n \ le 100000) $ points. Put points on at least two pieces, each round will be all the pieces toward the father, the presence of the end pieces overlap, set up a total of $ T $ rounds, contributed $ a [T] $. Ask all of $ 2 ^ n - n - 1 $ initial number of rounds of chess sum of the contributions of $ 998 244 353 $ modulo.

$$ \ begin {aligned} \ sum_ {S} a [\ text {S number of rounds which can be performed}] & = \ sum_S \ sum_ {T \ ge 0} [\ text {S T can be performed over rounds}] (a [T + 1] - a [T]) \\ & = \ sum_ {T \ ge 0} (a [T + 1] - a [T]) \ sum_S [\ text {S can be performed over the T Round}] \ end {aligned} $$

REFLECTIONS

Given a tree $ n (n \ le 100000) $ points. Put pieces on at least two points, each round will be all the pieces toward the father, the presence of the end pieces overlap. Multiple sets of inquiry, each given $ k $, $ k $ asked to select up to two pieces can be much bout.

To find out the number of segments $ T $ rounds, half of the array.

Guess you like

Origin www.cnblogs.com/Sdchr/p/11106344.html