Problem link https://codeforces.net/contest/615/problem/D
My Submission https://codeforces.net/contest/615/submission/78009885
Can anyone please tell why my submission is getting WA . I have read the editorial and got the solution but i would like to know why this approach is not working. I am trying this for a long time and have no clue. Please help!!