114362024-09-24 09:56:35probaLeghosszabb nyaralás (75 pont)python3Time limit exceeded 42/75298ms14708 KiB
sor1 = list(map(int, input().split(' ')))
hatar = sor1[1]
sor2 = list(map(int, input().split(' ')))
m = 0; ossz = 0; db = 0; resz = []
for i in range(len(sor2)):
    if sor2[i] >= hatar:
        ossz = 0
        if m == 0:
            m = 1;
        resz = []
        db = 0
        
    elif ossz+sor2[i] <= hatar:
        resz += [sor2[i]]
        ossz += sor2[i]
        db += 1
        if m < db:
            m = db
    
    else:
        while db>0 and ossz+sor2[i]>hatar:
            ossz -= resz[0]
            db -= 1
            resz.pop(0)
            
        ossz += sor2[i]
        resz += [sor2[i]]
        db += 1
        
    
print(m)
        
        
        
    
SubtaskSumTestVerdictTimeMemory
base42/75
1Accepted0/017ms3176 KiB
2Time limit exceeded0/0291ms14624 KiB
3Accepted3/317ms3176 KiB
4Accepted3/317ms3176 KiB
5Accepted3/317ms3216 KiB
6Accepted3/317ms3176 KiB
7Wrong answer0/317ms3192 KiB
8Accepted4/416ms3176 KiB
9Accepted4/417ms3320 KiB
10Accepted5/517ms3176 KiB
11Accepted5/534ms3964 KiB
12Accepted5/529ms4200 KiB
13Accepted7/798ms5848 KiB
14Time limit exceeded0/7298ms10424 KiB
15Time limit exceeded0/7298ms13596 KiB
16Time limit exceeded0/8296ms11364 KiB
17Time limit exceeded0/8298ms14708 KiB