(int x)
| 127 | } |
| 128 | |
| 129 | public static int findroot(int x) { |
| 130 | access(x); |
| 131 | splay(x); |
| 132 | down(x); |
| 133 | while (ls[x] != 0) { |
| 134 | x = ls[x]; |
| 135 | down(x); |
| 136 | } |
| 137 | splay(x); |
| 138 | return x; |
| 139 | } |
| 140 | |
| 141 | public static void split(int x, int y) { |
| 142 | makeroot(x); |