Find the two indices l , r such that A [ l ] > A [ i ] < A [ r ] and l < i < r using expand function
for ( int i = 0 ; i < N ; ++ i ) { big = max ( { big , A [ i ] } ) ; mp [ i ] = expand ( i , A ) ; iToA [ i ] = A [ i ] ; AToi [ A [ i ] ] = i ; }