new less stupid implementation of DP solver knapsnack 0-1