Given an array where each element contains 2 numbers : a(i),b(i) i.e
array[0] = pair(a(0),b(0))...
array[i] = pair(a(i),b(i))
There are two type of operations :
UPDATE i,c,d : array[i] = pair(c,d) i.e array[i] is updated to new pair
QUERY x : Find maximum of all : (a(i))*x + b(i)
I created a segment tree with each node as pair of ((a(i)),(b(i)))
Now my doubt is since every query requires multiplying first member of each node of segment tree with x , complexity for each query turns to be O(n)
How can I reduce the complexity to O(log n ).