ZROI 19.08.10 simulation game

Portal

EDITORIAL: In order to protect copyright is Rui topic, here and hold surface title, write only problem solution.


  • A

\(20pts:\)

Enumeration sequence is then run violence, complexity \ (O (n-^. 6) \) .

\([50,80]pts:\)

Enumeration into dfs, after each reduction operation. Complexity \ (O (n-^. 3) \) .

All zeros or all 1 can be returned directly.

Excellent writing can live \ (80pts \) .

\(100pts:\)

Similar non-recursive fft wording, after bitrev bit operation can be optimized.

Four lowest may be pretreated, complexity \ (O (. 4. 3-n-^ {}) \) .

And then madness cards often get away with (

However, due to the large swk constant human food, obviously all pruning are added still hung up qwq

Solve the case, the original swk too dishes on each floor were reconstructed again recursive structure, the structure was also used a vector, so much \ (12 \) times the constant, died.


  • B

\(80pts:\)

Enumeration minimum difference, is set to \ (d \) .

Statistical minimum difference greater than or equal \ (D \) of the difference between the maximum and the set, the minimum difference is found to be a \ (X \) set, it is just the difference between the maximum counted \ (X \) times.

DP directly, provided \ (F_i \) represents the former \ (I \) elements, and the first \ (I \) element will be selected and the difference between the maximum. You need a bunch of prefixes and when transferring.I especially strange to write the code

\(100pts:\)

Still enumeration \ (D \) , each \ (D \) enumerated set number of elements \ (X \) , found \ (DX \ n-Leq \) , so the complexity of the enumeration \ (O (n \ the n-log) \) .

Then the number of combinations just click on it.

Found set maximum and minimum values ​​are symmetrical, it may be considered separately.

The minimum value is considered enumeration \ (C \) , then the program number \ ((^ {NCX (. 1-D) X-~~~~~~~~ {_}}. 1) \) . I.e. Select \ (X \) elements, included behind them \ (d-1 \) additional space, which is located in a position \ (C \) element must be selected, and the front can not have any selected element, this element can be directly deleted.

Set \ (A = NX (. 1-D), B =. 1-X \) , then the total contribution \ (\ sum_ {c = 1 } ^ {ab} c \ cdot (^ {ac} _ {~~~ b}) = \ sum_ {c = b} ^ a (ac) \ cdot (^ c_b) = \ sum_ {c = b} ^ a (a + 1) \ cdot (^ c_b) - (c + 1) \ cdot (^ C_B) \) .

The latter half open, to give \ ((c + 1) \ cdot (^ c_b) = \ frac {(c + 1) c!} {B! (Cb)!} = (B + 1) \ frac { (C +. 1)!} {(B +. 1)! (CB)!} = (B +. 1) \ CDOT (^ {} _ {C + B +. 1. 1}) \) .

Substituting this back into the equation, to give \ (\ sum_ {c = b } ^ a (a + 1) \ cdot (^ c_b) - (b + 1) \ cdot (^ {c + 1} _ {b + 1}) = (A +. 1) \ CDOT (^ {} _ {C +. 1. 1} + B) - (B +. 1) \ CDOT (2 ^ {} _ {C + B + 2}) \) . Can \ (O (1) \) is calculated.


  • C

swk will not do find problems observed so glorious burst of zero. However, we have cut out the problem, so swk dish died.

An important conclusion is that each point will only go up.

Under emotional understanding is that the higher up the side of the more sparse.

So each point only \ (O (\ log) \ ) points associated with it, to build a side directly run on it.

The above wording is too much trouble. Write a little better approach is bound to meet at two points near lca. For each point can be worked up without the closest ancestor bridge, greedily looking for the highest ancestor can be. Japanese sentence requires two sides meet at points where ancestors.

Guess you like

Origin www.cnblogs.com/suwakow/p/11375089.html