Graphcuts for General Quadratic Binary Problems