202472026-01-05 17:44:31algoproLeggyorsabb pénzkeresés (50)pypy3Runtime error 16/5079ms32000 KiB
# UUID: 24c67fce-1fe3-4997-a995-7ac898313553
n, p = map(int, input().split())
napok = list(map(int, input().split()))

l = 0
cur_sum = 0
min_len = n + 1

for i in range(n):
    cur_sum += napok[i]

    while cur_sum >= p:
        min_len = min(min_len, i - l + 1)
        cur_sum -= napok[l]
        l += 1

if min_len <= n:
    print(min_len)
else:
    print(0)
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/043ms19376 KiB
2Runtime error0/067ms32000 KiB
3Accepted2/239ms19512 KiB
4Accepted2/239ms19452 KiB
5Accepted2/245ms19336 KiB
6Accepted2/259ms21700 KiB
7Accepted2/259ms22624 KiB
8Accepted2/254ms22248 KiB
9Accepted2/264ms22244 KiB
10Accepted2/259ms22424 KiB
11Runtime error0/265ms32000 KiB
12Runtime error0/274ms32000 KiB
13Runtime error0/276ms32000 KiB
14Runtime error0/276ms32000 KiB
15Runtime error0/268ms32000 KiB
16Runtime error0/275ms32000 KiB
17Runtime error0/276ms32000 KiB
18Runtime error0/275ms32000 KiB
19Runtime error0/275ms32000 KiB
20Runtime error0/265ms32000 KiB
21Runtime error0/279ms32000 KiB
22Runtime error0/265ms32000 KiB
23Runtime error0/275ms32000 KiB
24Runtime error0/275ms32000 KiB
25Runtime error0/268ms32000 KiB
26Runtime error0/264ms32000 KiB
27Runtime error0/275ms32000 KiB