202692026-01-05 18:22:40algoproLeggyorsabb pénzkeresés (50)pypy3Wrong answer 0/50193ms32004 KiB
# UUID: fc80c7de-bc84-4d66-8531-351dc0e5315e

N,P = [int(x) for x in input().split()]
F = [int(x) for x in input().split()]+[0]
szamok=1
osszeg=F[0]
min=N
i=0
j=1
if osszeg >= P:
    min=szamok
while j < N+1:
    print(i,j)
    if osszeg+F[j] < P:
        osszeg+=F[j]
        szamok += 1
        j+=1
    else:
        print(min,szamok,osszeg,i,j)
        
        if min > szamok:
            min=szamok
        osszeg-=F[i]
        szamok-=1
        i+=1
        
print(min+1)
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/039ms19520 KiB
2Runtime error0/0189ms32000 KiB
3Wrong answer0/250ms21188 KiB
4Wrong answer0/248ms21472 KiB
5Wrong answer0/246ms19944 KiB
6Wrong answer0/287ms24640 KiB
7Wrong answer0/2109ms26060 KiB
8Wrong answer0/2118ms25576 KiB
9Wrong answer0/290ms24552 KiB
10Wrong answer0/2111ms25876 KiB
11Runtime error0/2167ms32000 KiB
12Runtime error0/2174ms32000 KiB
13Runtime error0/2175ms32000 KiB
14Runtime error0/2151ms32000 KiB
15Runtime error0/2157ms32000 KiB
16Runtime error0/2171ms32000 KiB
17Runtime error0/2151ms32000 KiB
18Runtime error0/2166ms32000 KiB
19Runtime error0/2188ms32000 KiB
20Runtime error0/2179ms32000 KiB
21Runtime error0/2148ms32004 KiB
22Runtime error0/2180ms32000 KiB
23Runtime error0/2193ms32000 KiB
24Runtime error0/2153ms32000 KiB
25Runtime error0/2174ms32000 KiB
26Runtime error0/2150ms32000 KiB
27Runtime error0/2158ms32000 KiB