bitmask DP