[closed] Codeforces Mashmokh and ACM

Problem Statement : Click here

Can anyone Explain me this one?

I understood the logic behind this FROM HERE .

I need the implementation code with nice explanation . :slight_smile: .

Thanks in advance.

Have you even tried implementing it ?
If you understood the solution then why not implement it yourself ? You will be gaining very little if after reading the editorial of a problem, you just look at someone elseโ€™s implementation for it.

//