TOPIC

TLE - Python

Jose Henrique asked 1 month ago

while True: LE = list(map(int, input().split())) if(LE == [0,0]): break N = LE[0] B = LE[1] LB = list(map(int, input().split()))

for n in range(N + 1):
    teste = "false"
    for b in range(len(LB)):
        LAux = LB[:]
        LAux.remove(LB[b])
        for b1 in range(len(LAux)):
            for b2 in range(b1,len(LAux)):
                v = LAux[b1] - LAux[b2]
                if(v < 0):
                    v *= -1
                if(v == n):
                    teste = "true"
                    break
            if(teste == "true"):
                break
        if (teste == "true"):
            break
    if(teste == "false"):
        break
if(teste == "false"):
    print("N")
else:
    print("Y")

Tá dando TLE e não entendo o porque

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.