Problem: Home » Practice(school) » Winning Strategy

I have been trying to solve the problem and here is my submission:

https://www.codechef.com/viewsolution/36843509

I couldn’t findout where I went wrong and I could see most of the other accepted answers contains sorting.

I couldn’t figure out the purpose of sorting for this problem statement.

Finally I got it right.

Here is my submission: https://www.codechef.com/viewsolution/36857513

Thanks