I checked my code on codeshef’s compiler and it is giving the correct output but at the time of submitting they are saying that output is wrong.
The problem:https://www.codechef.com/problems/TLG
my code:
l=list()
li=dict()
t=int(input())
for p in range(t):
(a,b)= map(int,input().split())
l.append(abs(a-b))
li[abs(a-b)]=a-b
Q=max(l)
if li[Q]==Q:
print(1,Q)
else:
print(2,Q)
you are getting the question wrong. you have to calculate the cumulative score after each round. see the question very carefully you will understand by seeing in the 2nd table what cumulative score means. after that you have to calculate the difference of cumulative sum. That will decide the winner . You are not calculating the cumulative sum you are just calculating the difference of inputs.