202492026-01-05 17:46:37algoproLeggyorsabb pénzkeresés (50)pypy3Runtime error 16/5079ms32000 KiB
# UUID: c2ccafa7-a685-4e41-ab1c-ad4fc6b4a3d1
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/037ms19436 KiB
2Runtime error0/067ms32000 KiB
3Accepted2/243ms19552 KiB
4Accepted2/243ms19440 KiB
5Accepted2/245ms19332 KiB
6Accepted2/250ms21736 KiB
7Accepted2/264ms22504 KiB
8Accepted2/261ms22244 KiB
9Accepted2/254ms22248 KiB
10Accepted2/259ms22444 KiB
11Runtime error0/268ms32000 KiB
12Runtime error0/268ms32000 KiB
13Runtime error0/279ms32000 KiB
14Runtime error0/275ms32000 KiB
15Runtime error0/265ms32000 KiB
16Runtime error0/267ms32000 KiB
17Runtime error0/276ms32000 KiB
18Runtime error0/276ms32000 KiB
19Runtime error0/278ms32000 KiB
20Runtime error0/264ms32000 KiB
21Runtime error0/275ms32000 KiB
22Runtime error0/265ms32000 KiB
23Runtime error0/275ms32000 KiB
24Runtime error0/272ms32000 KiB
25Runtime error0/274ms32000 KiB
26Runtime error0/265ms32000 KiB
27Runtime error0/275ms32000 KiB