2019 Summer Hang two day6 test summary

T1

Subject to the effect

Give you a point right sides are tree 1, find a point such that the distance of the furthest point of the nearest point from the output from the point farthest point to point.

sol

2 except the diameter of the output tree is rounded up.

Proved slightly

T2

Subject to the effect

You \ (n-\) stick and \ (m \) views interrogation, the stick length i \ (a_i \) , each time you ask for two numbers \ (L, R & lt \) , you want to \ (l, \ r) interval is selected to form a triangular stick 3, so that the maximum perimeter. Without a triangle composed of three pieces of wood can be output within the interval -1. \ (1 <= n <= 10 ^ 5,1 <= m <= 5 * 10 ^ 5, a_i <= 10 ^ 9 \)

sol

This correction is the original multi-joint measurement of the title, according to the greedy, before removing the first, second and third long pole, a triangle look can spell, can not continue to remove the second, third and fourth long pole, continues to determine . Worst case stick length Fibonacci number, item more than 45 \ (10 ^ 9 \) , so necessarily determined after 45 makes up a triangle. Now, the question becomes Interval k big problem, since without repair, the Chairman of the tree can be. Time complexity: \ (\ Theta (45mlog_2n) \) .

T3

Subject to the effect

To give you a length \ (n-\) 01 and the string \ (m \) views interrogation, the \ (I \) times will ask you \ (L \) and \ (R & lt \) , you need to output \ (L \) to \ (R & lt \) a maximum value at the end of the longest common prefix of pairwise suffix.

sol

Will not. Positive solutions to use SAMand LCTvery malignant tumor, may not be able to make up the short term.

Guess you like

Origin www.cnblogs.com/hht2005/p/11402661.html