average complexity DP