try:
t = int(input())
temp = 0
c = []
for i in range(t):
x, y = map(int, input().split())
d = x-y
if d >= 0:
c.append((1,d))
else:
d = abs(d)
c.append((2,d))
if temp < d:
temp = d
for i,j in c:
if j == temp:
print('{} {}'.format(i,j))
except : pass
I have used try, except as codechef giving me nzec exception everytime.
I think your logic is wrong here @parth111 …I tried with your code and it is giving wrong answer on submit…in the example case u will get the maximum difference for the first one itself so it giving crct answer for that…u need to change ur logic and u need to find the difference of current turn by depending on the previous turn…
Thanks i got the meaning of question now and i tried even with custom inputs but still nzec exception persists that’s why i have to use try and except.
Same Issue With My Code.
Any Explanation Appreciated.
TW = 1
W = 1
ML = 0
for tc in range(int(input()):
N, K = map(int, input().split(" "))
if K > N:
K, N = N, K
TW = 2
L = K - N
if ML < L:
ML = L
W = TW
print(f"{W} {TW}")