202622026-01-05 18:12:19algoproLeggyorsabb pénzkeresés (50)pypy3Wrong answer 0/50123ms32000 KiB
# UUID: 24539c1f-5f1a-447b-8161-078aa6d89e41

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)
        
        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/043ms19596 KiB
2Runtime error0/0123ms32000 KiB
3Wrong answer0/239ms19676 KiB
4Wrong answer0/239ms19812 KiB
5Wrong answer0/239ms19844 KiB
6Wrong answer0/282ms23532 KiB
7Wrong answer0/274ms23528 KiB
8Wrong answer0/285ms23528 KiB
9Wrong answer0/271ms23528 KiB
10Wrong answer0/283ms23724 KiB
11Runtime error0/2101ms32000 KiB
12Runtime error0/2108ms32000 KiB
13Runtime error0/2122ms32000 KiB
14Runtime error0/2115ms32000 KiB
15Runtime error0/2108ms32000 KiB
16Runtime error0/2119ms32000 KiB
17Runtime error0/2105ms32000 KiB
18Runtime error0/2104ms32000 KiB
19Runtime error0/2119ms32000 KiB
20Runtime error0/2119ms32000 KiB
21Runtime error0/2119ms32000 KiB
22Runtime error0/2101ms32000 KiB
23Runtime error0/2104ms32000 KiB
24Runtime error0/2100ms32000 KiB
25Runtime error0/2122ms32000 KiB
26Runtime error0/2119ms32000 KiB
27Runtime error0/2101ms32000 KiB