from AtCoder Library Practice Contest ACLPC_J J - Segment Tree セグメント木はこういう操作を高速にできる木 クエリ3に関しては二分探索をする