Problem Link : Link
I'm not able to understand the editorial clearly. I'm stuck in the last part. It says "We should minimize the value of f(a,b) under the constraint that d(x,y) ≤ x*a + y*b + f(a,b) for all 1 ≤ x ≤ A, , 1 ≤ y ≤ B." Why do we have to minimize f(a,b)? Can someone give more mathematical proof or intuition ?