Pashmak and Parmida's Problem

I didn’t understand Tutorial given and Codeforces Editorial,plz make me it clear in simple words.

Hey @Bhawna
Check this :https://www.quora.com/How-do-I-solve-459D-Pashmak-and-Parmidas-Problem-on-Codeforces

I still didn’t get…
plz help!!

Hey @Bhawna
From where you aren’t able to understand in vedio.
I will try my best but I don’t think that I can explain you better than Sir