Help in a game theory question

Why is my code giving partial correct and editorial also uses same logic
https://www.codechef.com/viewsolution/34926664