My issue
Where my code is wrong?
My code
rounds=int(input())
lead=0
win=0
for tc in range(rounds):
P1,P2=map(int,input().split())
if abs(P1-P2)>lead:
lead=abs(P1-P2)
if P1-P2>0:
win=1
if P2-P1>0:
win=2
print(win,lead)
Problem Link: CodeChef: Practical coding for everyone
@vivekscode
we are taking the input of both players’ scores in each round and adding up these scores to the total of each player. the we are calculating the lead of both players till that round & updating the max values
plzz refer this code
# cook your dish here
N = int(input())
leader = 0;
lead = 0;
player1 = 0;
player2 = 0;
for _ in range(N):
a, b = map(int, input().split())
player1 += a;
player2 += b;
diff = abs(player1-player2);
if(diff > lead):
lead = diff;
leader = 1 if player1 > player2 else 2;
print(leader, lead)