95% but failed the memory tests

not only used two union find objects, but also a boolean array