113482024-08-20 23:15:11probaLeghosszabb nyaralás (75 pont)python3Time limit exceeded 13/75215ms13536 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 += [i]; x = len(t); i+= 1
        if x > h:
            h = x
    
    while i < napok and osszeg > penz:
        osszeg += nap[i]; t += [i]; i+= 1
        osszeg -= t[0]
        t.pop(0)
            


print(h)
        
    
            
        
    
    
    
    
SubtaskSumTestVerdictTimeMemory
base13/75
1Accepted0/017ms3044 KiB
2Time limit exceeded0/0215ms13536 KiB
3Accepted3/317ms3044 KiB
4Accepted3/317ms3044 KiB
5Wrong answer0/317ms2828 KiB
6Wrong answer0/317ms2936 KiB
7Wrong answer0/317ms2928 KiB
8Wrong answer0/417ms2952 KiB
9Wrong answer0/417ms3192 KiB
10Wrong answer0/518ms3044 KiB
11Wrong answer0/528ms3776 KiB
12Wrong answer0/530ms3996 KiB
13Accepted7/7114ms7548 KiB
14Wrong answer0/7145ms10040 KiB
15Time limit exceeded0/7204ms13284 KiB
16Wrong answer0/8167ms10900 KiB
17Time limit exceeded0/8210ms13412 KiB