guys I got the logic part but I m unable to implement it .it would be great and really appreciated if you kindly share your approach and your solution with little explaination so that I could get it .it is a problem from codechef may long challenge 2020 here is the link to the problem https://www.codechef.com/MAY20B/problems/CHANDF just copy it and paste in the URL section. thanks for your time.if anyone have any doubt you can ask about it too related to the above mentioned problem.








Auto comment: topic has been updated by pksingh290 (previous revision, new revision, compare).
Hey, but the editorial section on the CodeChef https://discuss.codechef.com/t/chandf-editorial/63302 is very exhaustive. Although, it contains two solutions which follow the editorial. Do you still have questions?
Also, video editorial is here: https://www.youtube.com/watch?v=rzaP4qd-b_M&t=698s
I have watched this one but this seems very poor .he didn't explained it well.also I tried to understand the solution given in editorial but it is getting over my head
I desperately want to solve this problem so if anyone can help in anyway will be really great.
See this.
thanks a lot this was really helpful