2019-9-9 do title record

1, Roma games:

Leftist tree template.

Small roots heap: Merge selected small to do the root, denoted by $ r1 $, then $ r2 $ merger to $ r1 $ on the right (the original $ r1 $ left long, short on the right), and then update the father, to determine the length of the relationship between the exchange son, updates length.

With $ fhq_treap $ Delete to delete the way.

Find a set of methods and investigation, but without the path compression.

2, tricky operations:

Unicom block with the left side tree minimum maintenance, with the global minimum maintenance $ $ multiset.

3, captured the city:

All the knights a deal, because every knight will join the Legion once, died once, so if we only maintain these events, the complexity is correct, it is easy to think of leftist tree.

Whether notice plus a number, multiply or a positive number, relative size in the inner leftist tree (set maintained) unchanged. So we can maintain by playing lazy plus mark (similar to the $ fhq_treap $) way, multiply.

To a point directly to the value is less than the defense of the Knights pop leftist tree declared dead, then still leftist tree in the elements can be marked modify lazy mark,

To maintain the mark as lazy as $ merge $ $ fhq_treap $, $ pushdown $ when $ pop $.

4, [APIO2012] dispatch:

After selecting managers, selected point must be the child inside the tree, as much as possible. So choose small, merge directly to the budget over a large part of the pop-leftist tree can be.

5、Roads in Yusland

$ Aysn $ recommended to me immortal title, $ yyb $ also wrote. The results for a long time did not want to do it. Times, and sure enough I was too weak.

Is a greedy operation go back belt.

Considered from bottom to top, the parent for each edge point, it can not reach the edges of the shells to the chain, at this time, the stack may cover elements are to this edge, and we find a minimum weight from below covering up the chain of this edge, then count it to answer to, and keep it to themselves and heap all the chain minus its weight, meaning: if one day, find a better than it the chain, not only can put the complete edge coverage, you can also cover more upper side, put the election now remove this edge, choose better.

If you know the process, correctness should not be difficult to understand it.

6、Dynamic Ranking

Last year the title will do, rewrite today, when it reviewed.

In the case without modification:

If the sequence of length $ n $, then we need $ n $ trees tree line, they are built for the range, the first $ i $ represents the number of trees Chairman tree $ a_1, a_2, ..., a collection of a_i $ formation, in sequence, one after the base is equal to the previous one hanging chain, when such a lookup, we only care about the first $ $ R & lt trees and trees $ l-1 $, on the binary value range, and finally determine the next point, in this process, two numbers is the pointer to move together with.

Extended to the case with modifications:

We still need $ n $ trees tree line, but the first $ i $ trees on behalf of the Chairman of the tree $ a [i], a [i-lowbit (i)] ... $ collection, Chairman of the build tree when formed, will not There is a relationship is another basis, so should be inserted into $ $ a_i $ i, i + lowbit (i) ... $, the time to find and to determine the composition of the prefix and up $ log [l-1 ] + log [r] $ Chairman tree locations, two check points directly above range is legitimate, the pointers are moving along the same direction.

7、【BZOJ2588】Count On a Tree

Find $ k $ large chain on the tree, I do not know how to deal with (thought to chain tree split), but read the solution to a problem, only to find I would, that state. . . I found a string of problems and routines of Jiangsu is the same.

On the basis of X $ $ $ fa [x] $ plus the $ X $ of the weight, when determined to find four segment tree, namely $ u, v, LCA (u, v), fa [LCA (u , v)] $, then these tests on it.

8, [forest] BZOJ3123

Operating with a merge operation in question 7, then merge heuristic directly on the line. But this is a tree without roots, how heuristic merge it?

Choose a maintenance $ size $ Unicom block, then make contact small block Unicom China Unicom's father is a big block, so that each time only for each point in the small Unicom block reconstruction of a chain can be.

9, [task] BZOJ3932 inquiry system

Chairman of a tree, by the method of scanning lines, each concerned only change, handles inquiries directly after the first $ x $ trees line the tree-half can be.

10] [BZOJ3295 dynamic reverse order

I had been blocking the card later, the complexity of the root sets in $ log $ root, now think about the size of a block can also be better. . . .

Then $ aysn $ write fairy Chairman of the tree, I put a $ D $, ooo, ooo.

Now look seems to be water, with modifications Chairman tree, is the anti difficult (being not seem difficult, but I am used to this kind of thinking), each time adding a number, check how the previous few older than he, how many behind the number is smaller than he, is the complexity of two $ log $.

11, [delicious] BZOJ4571

 Bitwise consider the look of the scope of each in a narrow range in.

Guess you like

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