113492024-08-20 23:21:14probaLeghosszabb nyaralás (75 pont)python3Runtime error 10/75298ms13536 KiB
'''napok = 8; penz = 10
nap = list(map(int, '3 6 4 2 3 7 2 9'.split(' ')))

with open('be2.txt','r') as f:
    sor = list(map(int, f.readline().strip().split(' ')));
    nap = list(map(int, f.readline().strip().split(' ')))'''
sor = list(map(int, input().split(' '))); nap = list(map(int, input().split(' ')))
napok = sor[0]; penz = sor[1]

i = 0; h = 0; osszeg = 0; t = []
while i < napok:
  
    #print(osszeg, t)
    
    while i < napok and osszeg <= penz:
        osszeg += nap[i]; t += [nap[i]]; i+= 1; x = len(t)
        if  x > h:
            h = x
    
    while i < napok and osszeg > penz:
        osszeg += nap[i]; i+= 1
        osszeg -= t[0]; t.pop(0)
        
            


print(h)
        
    
            
        
    
    
    
    
SubtaskSumTestVerdictTimeMemory
base10/75
1Accepted0/017ms2916 KiB
2Runtime error0/0115ms13480 KiB
3Runtime error0/317ms3044 KiB
4Accepted3/317ms3096 KiB
5Runtime error0/318ms2960 KiB
6Runtime error0/318ms2984 KiB
7Runtime error0/317ms3016 KiB
8Wrong answer0/417ms3044 KiB
9Runtime error0/418ms3224 KiB
10Runtime error0/518ms3088 KiB
11Runtime error0/528ms3684 KiB
12Runtime error0/524ms4112 KiB
13Accepted7/7116ms5388 KiB
14Time limit exceeded0/7298ms10016 KiB
15Runtime error0/7152ms13292 KiB
16Time limit exceeded0/8296ms10852 KiB
17Runtime error0/8114ms13536 KiB