Dirty dynamic programming