States Compressin dynamic programming