how to solve this kind of problem?
can anyone suggest approach to solve this problem? https://mirror.codeforces.com/gym/102157/problem/3
Repovive Standard Round 2 Solution Discussion (with Anirudh)