I am struggling with this problem: https://dunjudge.me/analysis/problems/896/

It is suggested on cp-algorithms.com that convex hull trick can solve this problem. I read this problem a month ago and now come back to it I still cannot solve it.

Can anyone help me with this, Thanks in advance.