传送门
模板。
——代码
1 #include <cstdio> 2 #include <iostream> 3 #define N 300001 4 #define get(x) (son[f[x]][1] == (x)) 5 #define swap(x, y) ((x) ^= (y) ^= (x) ^= (y)) 6 #define isroot(x) (son[f[x]][0] ^ (x) && son[f[x]][1] ^ (x)) 7 8 int n, m; 9 int a[N], sum[N], son[N][2], rev[N], f[N], s[N]; 10 11 inline int read() 12 19 20 inline void update(int x) 21 28 } 29 30 inline void pushdown(int x) 31 39 } 40 41 inline void rotate(int x) 42 58 59 inline void splay(int x) 60 69 70 inline void access(int x) 71 74 75 inline void reverse(int x) 76 81 82 inline int query(int x, int y) 83 89 90 inline int find(int x) 91 97 98 inline void link(int x, int y) 99 104 105 inline void change(int x, int y) 106 112 113 int main() 114 130 if(s[0] == 'p') change(x, y); 131 if(s[0] == 'e') 132 136 } 137 return 0; 138 }View Code
上一篇:[BZOJ2594] [Wc2006]水管局长数据加强版(LCT + kruskal + 离线)
下一篇:[POJ1456]Supermarket(贪心 + 优先队列 || 并查集)
LCT









