The exact problem is here

and also tried to understand the problem given in this editorial

but not able to understand. Can anyone help me to understand the solution of this problem.

The exact problem is here

and also tried to understand the problem given in this editorial

but not able to understand. Can anyone help me to understand the solution of this problem.