(int x)
| 137 | } |
| 138 | |
| 139 | public static int findroot(int x) { |
| 140 | access(x); |
| 141 | splay(x); |
| 142 | down(x); |
| 143 | while (ls[x] != 0) { |
| 144 | x = ls[x]; |
| 145 | down(x); |
| 146 | } |
| 147 | splay(x); |
| 148 | return x; |
| 149 | } |
| 150 | |
| 151 | public static void split(int x, int y) { |
| 152 | makeroot(x); |