assignment E - segment tree, sweeping