114382024-09-24 10:23:13probaLeghosszabb nyaralás (75 pont)python3Runtime error 0/7546ms13540 KiB
N,P=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
a=0; b=0; ossz=0; mx=0
while b<N:
    if ossz>P:
        ossz-=A[a]
        a+=1
    else:
        ossz+=A[b]
        b+=1
    mx = db if b-a+1>mx and ossz<=P else mx
print(mx)
SubtaskSumTestVerdictTimeMemory
base0/75
1Runtime error0/017ms3048 KiB
2Runtime error0/045ms13540 KiB
3Runtime error0/316ms3108 KiB
4Runtime error0/316ms3048 KiB
5Runtime error0/316ms3048 KiB
6Runtime error0/317ms3048 KiB
7Runtime error0/316ms3192 KiB
8Runtime error0/417ms3064 KiB
9Runtime error0/416ms3048 KiB
10Runtime error0/517ms3100 KiB
11Runtime error0/519ms3708 KiB
12Runtime error0/519ms4072 KiB
13Runtime error0/737ms5592 KiB
14Runtime error0/741ms10144 KiB
15Runtime error0/745ms13292 KiB
16Runtime error0/843ms11112 KiB
17Runtime error0/846ms13468 KiB