segment tree (initial ver)