113502024-08-20 23:24:26probaLeghosszabb nyaralás (75 pont)python3Runtime error 10/75298ms13416 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)
        h = (x > h)*x +(x<=h)*h
            
    
    while i < napok and osszeg > penz:
        osszeg += nap[i]; i+= 1
        osszeg -= t[0]; t.pop(0)
        
            


print(h)
        
    
            
        
    
    
    
    
SubtaskSumTestVerdictTimeMemory
base10/75
1Accepted0/017ms3044 KiB
2Runtime error0/0118ms13416 KiB
3Runtime error0/317ms2952 KiB
4Accepted3/317ms3044 KiB
5Runtime error0/317ms3044 KiB
6Runtime error0/317ms2844 KiB
7Runtime error0/317ms2936 KiB
8Wrong answer0/417ms2916 KiB
9Runtime error0/417ms2936 KiB
10Runtime error0/517ms3192 KiB
11Runtime error0/529ms3684 KiB
12Runtime error0/524ms4068 KiB
13Accepted7/7136ms5428 KiB
14Time limit exceeded0/7298ms9964 KiB
15Runtime error0/7155ms13164 KiB
16Time limit exceeded0/8298ms10844 KiB
17Runtime error0/8119ms13416 KiB