202042026-01-04 22:22:00algoproLeggyorsabb pénzkeresés (50)pypy3Runtime error 16/5082ms32000 KiB
# UUID: 8b361f55-9836-49ff-b9f7-4024710fe54f
from sys import stdin
input = stdin.readline

N, P = map(int,input().split())
F = list(map(int,input().split()))

res = 10**7
i = j = 0
sum = F[0]
while j < N:
    if sum < P:
        j += 1
        if j < N:
            sum += F[j]
        else:
            break
    else:
        res = min(res, j-i+1)
        sum -= F[i]
        i += 1


print(res)
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/043ms19552 KiB
2Runtime error0/068ms32000 KiB
3Accepted2/243ms19560 KiB
4Accepted2/239ms19416 KiB
5Accepted2/246ms19432 KiB
6Accepted2/250ms21636 KiB
7Accepted2/259ms21668 KiB
8Accepted2/259ms21736 KiB
9Accepted2/250ms21668 KiB
10Accepted2/250ms21660 KiB
11Runtime error0/276ms32000 KiB
12Runtime error0/275ms32000 KiB
13Runtime error0/282ms32000 KiB
14Runtime error0/267ms32000 KiB
15Runtime error0/268ms32000 KiB
16Runtime error0/279ms32000 KiB
17Runtime error0/268ms32000 KiB
18Runtime error0/278ms32000 KiB
19Runtime error0/267ms32000 KiB
20Runtime error0/275ms32000 KiB
21Runtime error0/270ms32000 KiB
22Runtime error0/265ms32000 KiB
23Runtime error0/276ms32000 KiB
24Runtime error0/278ms32000 KiB
25Runtime error0/268ms32000 KiB
26Runtime error0/267ms32000 KiB
27Runtime error0/275ms32000 KiB