solve problem, BUT d is not max score