lineSegmentTree with two flag