Hey everyone, could you plz help me in this past contest problem I think this could be done using DP and come you with some states but it doesn't work for every case or maybe this is a simple maths problem. I'm sharing the pdf of the problem state, link of the contest
Thanks in advance.
Auto comment: topic has been updated by Naithani (previous revision, new revision, compare).