can someone provide editorial for this question?

help

#1

I am a beginner and need some help.

PROC18C


#2

See my discussion of my approach to this question here https://discuss.codechef.com/questions/133867/editorials-of-procon-2018?page=1#133873


#3

@joffan can u please elaborate the approach i cannot understand the DP Soln (I read yours) i am a newbie in DPs please help thank you :smiley: