You are given the following:
You are also provided with the following attributes:
If i=1, then Li=Ri=1
If 2≤i≤n, then 1≤Li≤Ri<i
DP1=A1
DPi=min(DP[Li,Ri])+Ai
The element A[x,y] is defined to be all the elements that are available in [a,b] of array A. For example, DP[2,3] indicates DP2 and DP3.
You are also provided with q queries that state the following:
Note
Original DP=[1,10,3,9] Query 1 DP=[0,0,2,6] Query 2 DP=[4,13,6,12]