ZROI 19.08.09 simulation game

Portal

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


  • A

\(70pts:\)

Maintaining a stack, scanning the other side, if the new element is added to the current from the same side of the stack, the stack is otherwise into the stack. Obviously brackets is a sequence substring, if and only if the stack is empty.

Enumeration starting point, you can simulate violence. Complexity \ (O (^ n-2) \) .

\(100pts:\)

For a right end point, which can be considered the left point and it matches.

Found that all legitimate left point, both the content of the stack are equal, Hash can judge.

In fact considering each addition of characters, it will only change once in the end, it can be maintained using a trie. Complexity \ (O (\ n-Sigma) \) .


  • B

\(20pts:\)

You can search just burst.

\(40pts:\)

Consider shaped pressure set \ (f_ {state} \) selected from the \ (State \) construction company, the biggest cost.

Each time the transfer to enumerate the last election of the construction company \ (i \) , now request \ (e_i \) .

Direct count is difficult to count, consider the inclusion and exclusion.

It found that some set of points, edges between them even before the company has been passed.

Selected from the enumeration of construction company before each subset \ (State '\) , which is the point of impact is \ (I \) set of points of intersection, repellent capacity coefficient \ ((- 1) ^ { | state '|} \) .

With the intersection point set bitset maintenance complexity \ (O (\ ^ Mn. 3 FRAC {} {W}) \) .

\(70pts:\)

Essentially only find different intersection \ (2 ^ m \) a pretreatment intersection size, can be directly calculated when the receiving repellent. Complexity \ (O (\ FRAC Mn ^ {2}} + {W m ^. 3) \) .

Or for each point, consider which point it appeared in the episode. Each subset to its set point does not appear, it weights \ (- 1 \) , pretreatment can be reduced complexity \ (m. 3 ^ \) .

\(100pts:\)

And high dimensional prefix: provided on a defined set of functions \ (F (S) \) , now requires \ (G (T) = \ sum_ {S \ subseteq T} F (S) \) . Direct seeking \ (O (3 ^ n) \) , but through some mysterious means , it can be reduced complexity \ (O (n-2 ^ \ n-CDOT) \) .

Pretreatment and inclusion and exclusion, respectively, and to the use of high dimensional prefix.


  • C

\(100pts:\)

Found that a plurality of rings arranged substitutions, the goal is the total number of ring becomes \ (n-\) .

How to change the ring would consider swapping two elements.

It found that if the exchange elements with a ring, the ring will split into two. Otherwise, two rings will therefore merge.

Thus minimizing the number of operations is equivalent to minimize the number of consolidated rings.

When will the merger consideration ring. For one ring, if more than one internal color (flop called ring), two from each exchange element color at the breakpoint, self-forming a new loop. Thus a metachromatic ring may be split directly into loopback, no merging.

Otherwise, the ring can not exchange any two elements, it must be combined with the ring include other colors.

Consider how many times at least need to be merged. It found that a combined ring can be combined and most of two different colors to the same color ring flop. All the same color in the same color ring, it can only merge with a ring of a different color with the color ring.

Therefore, a maximum number of two colors will appear the same color ring merger is optimal, with a heap can be maintained.

Special sentenced to ten thousand, ten thousand boundary. Not tune out the spicy chicken swk arena, the successful explosion of zero.

This question too hard to write a so put the code. Poke here qwq

For elimination heterochromatic ring, another wording is relatively simple, hand-picked one color, the color erasing all the first edges, leaving only one. The second time this edge to the entire ring will disappear.

Guess you like

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