problem like this Problem - 1492D - Codeforces
I would suggest you to always think of a simpler version of any (mostly a constructive type) problem and then go to the current version (given in the problem). This works for most ad-hoc, constructive or greedy problems.
And a very important advice
Read the problems carefully.
I am saying this because, the problem you mentioned, I couldn’t solve because I read it wrong. And it feels really sad .
2 Likes
thanks