19 analog solution to a problem

A. count

Conclusions title

A tree may be divided into d blocks,

If and only if the number of sub-tree nodes and node d has a multiple of $ \ frac {n} {d} $ a.

For any tree, size is a multiple of the number of nodes does not exceed d $ \ frac {n} {d} $ a.

In the above case, each node in accord with his father cut off the road, it is a legitimate program.

It proved.

 

 

 

B. Dinner

The sequence is divided on the circle segment k continuous intervals, so that the maximum value of the sum of the minimum region.

Obviously the answer to two points.

However, verification requires $ O (n ^ 2) $.

Multiplying each point in the pretreatment extending rearwardly node $ 2 ^ k $ segments can reach.

Thus for each verification, and the complexity of the queries pretreatment are $ O (nlogn) $,

Overall complexity $ O (nlog ^ 2n) $,

It should be accumulated is multiplied thought, with some quick power, maps are often used in combination.

 

 

 

C. chess

FIG construction, found in FIG point and the right point to the right point 0 1.

Define different routes for different points through at least a weight of 1 point.

The point right point zero shrink away,

That is, if there is a-> b-> c, where b is 0 right point, directly from the side of a building to c.

Directly after counting to the shortest.

Guess you like

Origin www.cnblogs.com/skyh/p/11351586.html