2019-9-14 do title record

1, BZOJ1493 [] [] necklace factory NOI2007

Already the previous years $ NOI $, and now it seems something ancient people learn I will not.

A ring, each element color, six kinds of operation.

  • $ Rotate \ k $: clockwise rotation necklace $ k $ units. I.e. the original position becomes now $ I $ $ i + k $ position.
  • $ Flip $: necklace along a given axis of symmetry inverted, i.e. the position necklace $ I $ and $ n + 2-i $ interchanging.
  • $ Swap \ i \ j $: color swap $ i $ and $ j $ position location necklace.
  • $ Paint \ i \ j \ x $: $ necklace starting position I $, $ J $ clockwise interval length dyed $ x $.
  • $ Count $: ask a few blocks of color on the entire necklace.
  • $ CountSegment \ i \ j $: Necklace inquiry from $ I $ start position, the number of color blocks clockwise interval length of $ $ J.

This thing is definitely better to maintain a $ splay $, but I have to use the tree line.
First of all, we have become a chain ring, $ 5,6 $ two operating segments trees obviously can directly apply online method of maintaining the number of blocks of color, when the end point is crossed then the two combined to answer on the line.
$ 3,4 $ is very simple, single-point range and modify the assignment.
$ 2 $ is also very simple, as you can playing flip mark to $ splay $, wait until the query chain $ pushr $ down.
$ 1 $ only change the mapping relationship, we record it, wait until the investigation of the reduction back on it.
Read the solution to a problem, find $ 2 $ false, because the tree line is not as free to separate sub-tree to a balanced tree (sub-intervals), so take the time to maintain a mapping between the minus sign on the line.

2、【CF666E】Forensic Examination

S $ give you a string and a string array $ $ T [1..m] $, $ q $ query times, each S $ Q $ substring $ S [pl..pr] $ $ T in [ which string l..r] $ in the number of occurrences of the largest and outputs the number of occurrences.

If the output of multiple solutions for the most forward one.

It is not many years before I skipped code suffix automaton agricultural problem it? Estimates now long forgotten, did not remember correctly, it should be the suffix automaton triple. So I do not write.

3、【CF700E】Cool Slogans

Given a string of length n $ s [1] $, lowercase letters. Define a sequence of strings $ s [1..k] $, satisfy properties: $ s [i] $ in $ s [i-1] (i \ ge 2) $ occurred at least twice (overlap position), I asked the biggest $ k $ is the number that the $ s [1] $ start to $ s [k] $ satisfies such a property.

$ S [I] $ $ s appears in [i-1] $ at least twice, then we can remove the rear portion is not covered by the $ s [i-1] $, and so is in the suffix tree corresponding ancestor / descendant relationship of a chain, directly connected to the tree line and determine whether the merger seeking a $ dis $ on the line?

That's it. (Exposed black boxer smile)

4, BZOJ3672 [] [] NOI2014 tickets (tree line, the slope of the optimization, dynamic programming)

As we all know, this is the road immortal question.

Methods All cities form a tree structure, from the city $ v $ access to the city was $ SZ $: Select City $ v $ ancestor of a $ a $, pay for tickets, by means of transport to reach the $ a $. Then select the city $ a $ ancestor of a $ b $, pay and reaches $ b $. And so on, until it reaches $ SZ $ City.

For any city $ v $, we will give away a vehicle restriction $ lv $. For the city $ v $ ancestry $ a $, and only when the total length of all roads between them does not exceed $ lv $, $ v $ from the city by a ticket before they can reach the city $ a $, otherwise it can not be one-stop shopping tickets to arrive. For each city $ v $, we will give two non-negative integers $ pv, qv $ fares as a parameter. If the city $ v $ to $ a $ city all roads total length $ d $, then $ v $ from city to city fares purchased for $ a $ $ dpv + qv $.

Each city to find the root of the minimum cost.

Preserved, we have time to write.

5, [LR # 6] Fireworks (tree line, a scan line)

$ $ n- fireworks in a row, from left to right are height $ h_1, h_2, ... h_n $ , these highly pairwise disjoint.

  • Every $ Yoko $ can choose two adjacent fireworks exchange, such exchanges can be any number of times.
  • Per $ $ Yoko can also choose two non-adjacent pyrotechnic exchange, but this is at most one exchange.

Your task is to help $ Yoko $ with a minimum number of exchange so that the height of these fireworks is incremented from left to right.

If we can get a direct sequence selected two adjacent fireworks exchange, up to how many times

6、

Guess you like

Origin www.cnblogs.com/shxnb666/p/11520669.html