I attempted the question Singing Tournament at https://www.codechef.com/ZCOPRAC/problems/SINGTOUR/

I submitted a brute force solution which fetched 15 points.

I’m unable to come up with an efficient solution for this question. Could someone please give me hints to solve this? I see that many users have solved the problem. I can’t find any editorial or hints.

Thanks!