30 analog solution to a problem

A. tree

When do the exam outline reminiscent of ancient problem of memory.

Some expect the tree to go a few steps.

Obviously directly solving equations.

However, the complexity of $ O (qn ^ 3) $, using the properties of the tree to optimize it,

Dfs directly over the course of the solution out to be $ O (qnlogmod) $, which is the inverse of the log yuan.

However, only 20 points.

Each point of the pre-expected number of steps walked each son, went to his father's expectations a few steps.

Tree multiplier seeking lca, the prefix tree two processing functions and would be finished.

 

 

 

B. palindrome string

C. XOR

Guess you like

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