The fastest segment tree is the self-adjusting one according to the queries.
The root of self-adjusting segment tree is

, and for each vertex
%7D)
, we can choose arbitrary
)
and then split it into two vertices

and

. The following figure is an illustration of such a segment tree.

When we locate an interval in the segment tree, we need to visit some vertices. For example, the vertices in purple rectangles are visited when locating the interval

.
Formally, when we locate the interval

, let

be the set with minimum number of vertices such that their intervals are disjoint and the union of there intervals is

, all the vertices in S or the ancestors of some vertex in

will be visited.
Now you are given

queries

and you need to find a segment tree that minimizes the sum of visited vertices for all queries.