https://mirror.codeforces.com/contest/234/problem/G
This problem is the type of problem where I know everything needed but I still can't solve it. I always learn a lot from such problems
I am not interested in a solution, I know it, but how to approach the problem and reach a solution. How to think about it? What should have hinted me to consider using what was needed to solve it ?