minimal cover of segment in O(NlogN) with sweepline