optimize x^2+y^2-x*y where 0≤x≤d and 0≤y≤d