SRM 318 DIV 2 easy mid hard

DP is awesome...