A
8min -1
Daily WA registration questions. See the data range.
B
7min
\ (Ans=\sum |a_i-a_{i-1}|\)
C
33min
- For each \ (y-x=w\) condition, build a heap. From large to small, assign numbers sequentially, each time you take out \ (w\) the corresponding heap top element.
- Next we check to get the solution is legal. The solution is valid for just any point, and the maximum value of all points at the bottom left is less than the number of that point.
- Then press \ (x\)for all the points, and then press \ (y\) to sort through the array and press \ (y\) to insert the point number into the bit. Use this bit to maintain the prefix maximum value.
D
109min
- \ (dp[l][r][0/1][0/1]\) indicates that the interval \ ([l,r]\), the l-1\ the direction of the tree, the first (r+1\) tree, the direction of the inverted. Contribution to the answer.
- Consider the transfer. Divided into four cases
- The tree on the left, down to the left.
- The tree on the left, down to the right.
- The tree on the right, down to the left.
- The tree on the right, down to the right.
Emmmm first why I think the interval DP complexity is \ (O (n^3) \) Acridine!
And then the old thought of counting each tree's contribution to the answer, taking the desired additive. A lot of time has been wasted.
E
yy a bit, very can do. Lazy to die, do not want to write.
- After the map is built, we will get a base ring forest.
- We try to take each of the base ring trees to match the string it gives. We will reverse the base ring tree edge and then match the strings that need to be matched backwards.
- First on the ring crazy turn, can turn off a few characters is a few, the base ring tree removed the ring is a forest. We can continue to match on each tree.
Have time to fill it up. The problem of the base ring tree, the details are more Ah!
A little summary.
- See n points, N edge, out of instinct should also think of the base ring tree!
- See n points, n-1 Edge, out of instinct also should think of trees!
The base ring tree has a very playful nature, and the edges and points can be exactly one by one matched cf1027f
For example, each side can be regarded as an examination, each point can be seen, one day.
If it is a base ring tree, then the protagonist will be the display.
Then, the base ring tree is often played on the ring first, play on the ring, go to the tree to play.
Codeforces Round #331 (Div. 2)