The code is for kickstart2020 round A plates. 
I cannot pass the test set 2 with "TLE". Can anyone figure out why that 
happens? 
Thank you very much in advance. 

T=int(input())
for i in range(T):
    N,K,P=[int(s) for s in input().split(" ")] 
    beauty=[[int(s) for s in input().split(" ")] for j in range(N)]
    dp=[[0 for ii in range(P+1)] for jj in range(N)]
    pk=min(P,K)
    dp[0][1:pk+1]=[sum(beauty[0][0:k1]) for k1 in range(1,pk+1)]   
    for nn in range(1,N):  
        sum_s=[sum(beauty[nn][0:cc]) for cc in range(K+1)]
        for pp in range(1,P+1):   
            for xx in range(min(pp,K)+1): 
                dp[nn][pp]=max(dp[nn][pp],sum_s[xx]+dp[nn-1][pp-xx])
                
    print("Case #{}: {}".format(i+1, dp[N-1][P])) 

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/2ed03729-b759-4987-8df2-35f6494cb0db%40googlegroups.com.

Reply via email to