INOI 2022 Conquest

Hi. Can anyone please explain the solution to CodeChef: Practical coding for everyone

Is there an editorial for this? I cant see it

Hey, for now there is no official editorial for this problem, but the submissions of other candidates are visible to public. Incase you are unable to solve the problem please refer to the accepted solutions in order to understand the logic to solve the problem,