Provincial simulation 76 solutions

A. MiniumCut

First see this question, you can think of the smallest cut tree.

Then it is found that the minimum cut tree of the original image is equivalent to the original image.

That is to say, the answer can be expressed as a tree.

Then consider how to find this tree. The general idea is to consider each set of relationships from small to large or from large to small.

The latter idea is used here, probably applying the idea similar to Kruskal's reconstruction tree, and then found that the largest spanning tree of these relationships is the smallest cut tree.

Then violently judge whether it is legal or not, this problem is solved.

 

B. Tree

The easy answer is to choose a point set.

For all edges in the point set, you can select a path so that the coefficient is $ 1 $, and the other coefficients are all $ 2 $.

So write a subtree merge dp, record the number of points selected in the subtree, and how many endpoints have appeared in the subtree.

 

C. Tower

When I thought about this question, I found that the original palindrome can simply support double-ended insertion.

In fact, as long as the termination nodes are maintained at both ends.

Then for the expansion of the right end point, the termination node of the left end point can be changed only when the entire string is a palindrome string, so it is good to make a special judgment.

Then through the practice of the palindrome, you can probably think that for each expansion of the string, the change in answer is between $ 0 $ and $ 2 $.

So just make a hash to judge whether the answer increase of $ 2,1 $ is legal.

Guess you like

Origin www.cnblogs.com/skyh/p/12748244.html