| 212 | } |
| 213 | |
| 214 | forceinline void |
| 215 | OfflineMin::unite(int a, int b, int c){ |
| 216 | // c is the union of a and b |
| 217 | int ra = sequence[a].root; |
| 218 | int rb = sequence[b].root; |
| 219 | int large = rb; |
| 220 | int small = ra; |
| 221 | if (sequence[ra].rank > sequence[rb].rank) { |
| 222 | large = ra; |
| 223 | small = rb; |
| 224 | } |
| 225 | sequence[small].parent = large; |
| 226 | sequence[large].rank += sequence[small].rank; |
| 227 | sequence[large].name = c; |
| 228 | sequence[c].root = large; |
| 229 | } |
| 230 | |
| 231 | forceinline void |
| 232 | OfflineMin::makeset(void){ |