Reduction Game | Please share the approaches who have solved it.

Problem Link - https://www.codechef.com/ACMIND18/problems/REDCGAME
Problem Code: REDCGAME

I have not understood the solution here that’s why I asked this question separately

Okay. Which part(s) did you not understand specifically?