This is for the problem “Lead Game”.
I’m sure my error is a sneaky testcase, a situation I don’t expect. Can someone tell me what is wrong with my code? And also, if there is any way to improve it? Thanks. This is python BTW.
highScore = 0 winner = 0 lead = 0 n = int(input()) for x in range(n): t1,t2 = list(map(int,input("").split())) if t1 > t2: lead = t1-t2 if lead > highScore: highScore = lead winner = 1 elif t2 > t1: lead = t2-t1 if lead > highScore: highScore = lead winner = 2 print(str(winner) + " " + str(highScore))