Since I cant find the editorial i am asking my doubt here. my code to problem F
https://codeforces.net/contest/1729/problem/F
is repeatedly failing test case 7.
Here is my code for your reference:
https://codeforces.net/contest/1729/submission/172019259
thanks