题目就是给你一颗树,每次两个操作,一个是询问A到B的路径上边权的最大连续和,还有一个就是将一条路径所有边权修改成一个数。。。
树链剖分。。像一般线段树那样维护4个值。。。还有打标记。。
我写好之后翻了一下oimaster的park的代码。。对神牛的Orz之情如长江之水绵延不绝啊。。。不过我发现我的写法有点诡异。。我好像是完全忽略轻边直接全部都是线段树的。。所以速度好像慢很多囧。。不过似乎好写一点囧。。还有就是在线段树我直接按深度范围当区间了。。
最近树的题目做的好多啊。。接下来去做OTOCI还有QTREE的其他几道好了囧。。
我发现我GSS系列的题目只差GSS2了。。
Code:
www.ideone.com/qoxC6
This piece is an elegant dance between thought and emotion, where each idea flows naturally into the next. I found myself following your words, not just with my mind, but with my heart, as you navigated complex ideas with such grace. It’s writing that doesn’t just inform — it invites the reader into a deeper relationship with the material.