202632026-01-05 18:13:03algoproLeggyorsabb pénzkeresés (50)pypy3Wrong answer 0/50142ms32000 KiB
# UUID: c6f4c037-2f79-4ba6-9ae4-2a3eae7bc69d

N,P = [int(x) for x in input().split()]
F = [int(x) for x in input().split()]
szamok=[1]
osszeg=F[0]
min=len(F)
i=0
j=1
if osszeg >= P:
    min=szamok[-1]
while j < N:
    
    if osszeg+F[j] < P:
        osszeg+=F[j]
        szamok.append(szamok[-1]+1)
        j+=1
    else:
        print(szamok[-1],osszeg,i,j)
        
        if min > szamok[-1]:
            min=szamok[-1]
        osszeg=osszeg-F[i]
        szamok.append(szamok[-1]-1)
        i+=1
        
print(min)
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/039ms19620 KiB
2Runtime error0/0142ms32000 KiB
3Wrong answer0/239ms19920 KiB
4Wrong answer0/248ms21080 KiB
5Wrong answer0/239ms19652 KiB
6Wrong answer0/278ms24288 KiB
7Wrong answer0/290ms23984 KiB
8Wrong answer0/287ms23732 KiB
9Wrong answer0/276ms23784 KiB
10Wrong answer0/279ms23780 KiB
11Runtime error0/2112ms32000 KiB
12Runtime error0/2127ms32000 KiB
13Runtime error0/2128ms32000 KiB
14Runtime error0/2107ms32000 KiB
15Runtime error0/2131ms32000 KiB
16Runtime error0/2111ms32000 KiB
17Runtime error0/2126ms32000 KiB
18Runtime error0/2107ms32000 KiB
19Runtime error0/2134ms32000 KiB
20Runtime error0/2128ms32000 KiB
21Runtime error0/2119ms32000 KiB
22Runtime error0/2104ms32000 KiB
23Runtime error0/2120ms32000 KiB
24Runtime error0/2112ms32000 KiB
25Runtime error0/2112ms32000 KiB
26Runtime error0/2120ms32000 KiB
27Runtime error0/2122ms32000 KiB