Not able to solve the question

Hii…
I am trying to solve this question…
https://codeforces.com/contest/1343/problem/D
But not able to come up with a proper solution.
I have seen the editorial… Not able to get much intution…
Please look into this question.
Thanks

Hey @ashishnnnnn
Refer to this : https://www.youtube.com/watch?v=XZTeiMKoaVc :slight_smile:
If u still dont understand then refer to this as well : https://www.youtube.com/watch?v=QouZfBC9CVw :slight_smile:

Hey @ashishnnnnn
Have u understood the approach

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.