Can someone provide the editorial of TSECJ105 ?

@admin post editorial for this question https://www.codechef.com/TSCO2017/problems/TSECJ105

Its an external contest and admin won’t post any editorials for it!! You may request one though and community will be glad to help you out!!

I have given an explaination about the same problem in the following thread. You can have a look. https://discuss.codechef.com/questions/107047/what-is-logic-behind-this-problem