按照他的实现方法,在合并两个 RBT 时会 RE 。
应该写成:
x = getfa(x), y = getfa(y);
if(x == y) return;
int sx = t[x].size(), sy = t[y].size();
if(sx > sy) swap(x, y);
rbt::point_iterator it = t[x].begin();
for(; it != t[x].end(); it++) t[y].insert(*it);
t[x].clear();
merge(x, y);