• + 3 comments

    I think my approch is similar to yours but I'm getting Time out on a few test cases. Any idea what the timing out factor could be?

    n1,n2,n3 = input().strip().split(' ')
    n1,n2,n3 = [int(n1),int(n2),int(n3)]
    h1 = [int(h1_temp) for h1_temp in input().strip().split(' ')]
    h2 = [int(h2_temp) for h2_temp in input().strip().split(' ')]
    h3 = [int(h3_temp) for h3_temp in input().strip().split(' ')]
    
    ans=0
    
    while(min(len(h1),len(h2), len(h3))!=0):
    	if(sum(h1)==sum(h2)==sum(h3)):
    		ans=sum(h1)
    		break
    	else:
    		max([h1,h2,h3],key=sum).pop(0)
    
    print (ans)