Explanation of Convex hull trick in CCC (Hit The Coconuts) problem of July challenge 2019

In the post author says that we need to use convex hull trick to solve the problem efficiently.I read the trick but i am unable to apply it to given problem .
Can some one explain how the convex hull trick is applied in this case ?

Please look at this and love me.

6 Likes