0 -1 backpack problem c++ implementation