greedy+dp