zju 1610 code, use segment tree