possible = [i for i in possible if i%primes[night] == sum(a)] it should be sum(a) % primes[night]
On Sat, Apr 13, 2019 at 2:51 PM Saeon Piremakumar <[email protected]> wrote: > Kept getting a TLE for this problem, is my code slow or is it just wrong > somewhere > . > ##### CODE ######### > import sys > t, n, m = map(int, input().split()) > > def solve(n,m): > > primes = [16,9,5,7,11,13,17] > possible = list(range(1,m+1)) > for night in range(n): > for dummy in range(18): > print (primes[night],end = " ") > sys.stdout.flush() > > a = list(input().split()) > a = [int(i) for i in a] > possible = [i for i in possible if i%primes[night] == sum(a)] > if len(possible) == 1: > print(possible[0]) > sys.stdout.flush() > break > > for _ in range(t): > solve(n,m) > > ################### > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/23e6dabb-6c75-4188-8b4a-18a3e52b029b%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAGDEU-KJuWSoq4Wk7zR4XC7bV%2B2S4wgXfhDXZwmPdSjx0j0vTg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
