10.12 Summary

Overview

The total difficulty of completing cf: 2300 + 2300 + 2100 + 2100 + 2000 + 2000 + 900 + 2100 = 15800 2300+2300+2100+2100+2000+2000+900+2100=158002300+2300+2100+2100+2000+2000+900+2100=15800

Be wyq ≈ 20000 ≈ 200002 0 0 0 0 Hanging

Brief solution

CF1422D

This question 2300 is too much. The portals are sorted directly according to the horizontal and vertical coordinates, and the adjacent sides are violently connected. Then just run the shortest path.

P4552

A good thinking question, consider the interval [l, r] [l, r][l,r ] Add and subtract1 11 , which is equivalent to adding and subtracting1 1to the difference array1 . So we make the difference array greater than0 00 go to less than000 pairs, assuming greater than0 00 isxxx isyyy . Then the final difference array must be(0...., ∣ x − y ∣) (0....,|xy|)(0....,xy ) So the first answer ismax ⁡ (x, y) \max(x,y)max(x,y ) . For the second question, we consider how to set the difference array to0 00 . Then we can change the previous segment0 00 minus∣ x − y ∣ |xy|xy or subtract by itself, so the number of possible solutions is∣ x − y ∣ + 1 |xy|+1xy+1

CF960E

Consider the tree dp, we set fu, 0/1 f_{u,0/1}fu , 0 / 1It represents uuu is the number of even/odd numbers.
Then consider the up-and-down discussion in three cases.

1.从uuAn edge is not connected touu in the u subtreeThe points of the u subtree are connected to the edges

2. uuIn the u subtree, an edge is connected atuuu subtree is not invvv The points of the current subtree are connected to the edges

3. Never at uupoint of u subtree touuu subtree inner connecting edge

Dp by situation is fine

CF859E

It is also a classification discussion question. We put a connected block in the front and back position of each person. Consider a connected block. If it is a tree, the answer to the connected block is the size of the block. If the connected block has a ring, it is equivalent to a chain reaction, so there are two cases. If there is a self-loop, then the connected block has one kind. Finally, the multiplication principle can be counted.

CF796D

We consider those edges that can be repeated, which is a point uu of the edgeu is covered by two special points so you can delete edges. This bfs can be simulated.

CF771C

It is a tree dp again, we set fx, i f_{x,i}fx,iRepresents xxx distance within subtreexxx distances% k = is\%k=is % k=i the total number of steps,GX, G_ {X i, i}gx,iRepresents xxx distance within subtreexxx distances% k = is\%k=is % k=The number of points of i .

f x , i = ∑ v ∈ x f v , i − 1 , g x , i = ∑ v ∈ x g v , i − 1 f_{x,i}=\sum _{v∈x}f_{v,i-1},g_{x,i}=\sum_{v∈x}g_{v,i-1} fx,i=vxfv , i - 1,gx,i=vxgv , i - 1

For i = 1 i=1i=1 us tofx, 1 = Σ v ∈ xfvfx,1=vxfv , 0+gv , 0 Because it takes an extra step, these contributions must be added.

Let's first calculate 1 11 is the answer to the root, and then change the root dp.

So the answer is ∑ i ∑ jfi, j \sum_i\sum_j f_{i,j}ijfi,j

Guess you like

Origin blog.csdn.net/wangyiyang2/article/details/109039405