Google kick start round E
problem link How to solve problem D any help would be appreciated
Codeforces Round 1123 Solution Discussion