41132023-03-14 22:51:28kristofLeggyorsabb pénzkeresés (50)python3Runtime error 2/50144ms36816 KiB
n, p = map(int, input().split())
arr = list(map(int, input().split()))

eddigi = 0
bal = 0
jobb = 0
eddigi = arr[0]
shortest=n+1

for i in range(n):
    if eddigi < p:
        jobb += 1
        eddigi += arr[jobb]
        shortest = min(jobb-bal+1, shortest)

    if shortest < jobb-bal+1:
        eddigi -= arr[bal]
        bal += 1

print(shortest)
SubtaskSumTestVerdictTimeMemory
base2/50
1Runtime error0/017ms11036 KiB
2Runtime error0/0143ms33908 KiB
3Runtime error0/217ms11512 KiB
4Runtime error0/217ms11820 KiB
5Runtime error0/217ms12012 KiB
6Runtime error0/228ms14472 KiB
7Runtime error0/229ms14544 KiB
8Runtime error0/229ms14728 KiB
9Runtime error0/229ms14880 KiB
10Runtime error0/229ms14936 KiB
11Accepted2/267ms35280 KiB
12Runtime error0/2136ms35696 KiB
13Runtime error0/2140ms35708 KiB
14Runtime error0/2134ms35912 KiB
15Runtime error0/2136ms35788 KiB
16Runtime error0/2133ms36036 KiB
17Runtime error0/2144ms36040 KiB
18Runtime error0/2130ms35928 KiB
19Runtime error0/2138ms36140 KiB
20Runtime error0/2134ms36180 KiB
21Runtime error0/2131ms36092 KiB
22Runtime error0/2137ms36224 KiB
23Runtime error0/2140ms36416 KiB
24Runtime error0/2136ms36340 KiB
25Runtime error0/2143ms36408 KiB
26Runtime error0/2135ms36656 KiB
27Runtime error0/2142ms36816 KiB