Sir is this Problem of DP or it can be solved using other technique https://www.codechef.com/SEPT19B/problems/CHEFINSQ