HORSES - "Wrong Answer"

Can anyone shed some light on why this is a wrong answer?

try:

    for tc in range(int(input())):
        a= list(map(int,input().split(' ')))
        a = sorted(a)
        
        diff = abs(a[0]-a[1])
        for i in range(len(a)-1):
            if abs(a[i]-a[i+1])<diff:
                diff  = abs(a[i]-a[i+1])
        
        print(diff)

except:
    pass

You’re reading in the input wrongly (re-read the “Input:” section, the try running your program with the sample testcase), and then wrapping the whole thing in try ... except, obscuring your error :slight_smile:

2 Likes

God Damn it! Thank you so much, my bad! Still learning to use code chef!

1 Like