版本比较
题解 P3690 【【模板】Link Cut Tree (动态树)】
正文
增加 3 行删除 3 行
133 行未改动全部展开134135136137138138139140141142119 行未改动全部展开26226326426526626626726826927034 行未改动305306307308309309310133 行未改动全部展开
代码如下:
```cppinline int FindRoot(int x) inline int FindRoot(int x){ Access(x),Splay(x);//一波操作,将x转到根节点所在Splay的根 while(node[x].Son[0]) PushDown(x),x=node[x].Son[0];//尽量向左儿子拓展,注意每次拓展前先PushDown return Splay(x),x;//最后不忘Splay的优良传统:每执行完一个操作就Splay一下,防被卡119 行未改动全部展开 #define Which(x) (node[node[x].Father].Son[1]==x) #define Connect(x,y,d) (node[node[x].Father=y].Son[d]=x) #define IsRoot(x) (node[node[x].Father].Son[0]^x&&node[node[x].Father].Son[1]^x) #define MakeRoot(x) (Access(x),Splay(x),Rever(x)) #define Split(x,y) (MakeRoot(x),Access(y),Splay(y)) #define Split(x,y) (MakeRoot(x),Access(y),Splay(y)) int Stack[LCT_SIZE+5]; struct Tree { int Val,Sum,Father,Rev,Son[2];34 行未改动 case 3:LCT.Update(x,y);break; } } return F.clear(),0;} }```