made partDist use dynprog