make is_disjoint O(n+m) instead of O(n*log(m))