28522023-01-29 21:18:47kristofLeggyorsabb pénzkeresés (50)python3Wrong answer 4/50103ms36480 KiB
from itertools import accumulate

n, k = input().split()
n = int(n)
k = int(k)

arr = list(map(int, input().split()))
prefixArr = list(accumulate(arr))

l = 0
r = -1
eddigiSzam = 0
out = n
for i in range(n):
    eddigiSzam = prefixArr[i]
    while eddigiSzam >= k:
        eddigiSzam -= prefixArr[l]
        l += 1
        if eddigiSzam == k:
            out = min(i-l+1, out)

print(out)
SubtaskSumTestVerdictTimeMemory
base4/50
1Wrong answer0/017ms11320 KiB
2Wrong answer0/0100ms34040 KiB
3Wrong answer0/217ms11748 KiB
4Accepted2/217ms11796 KiB
5Wrong answer0/217ms11908 KiB
6Wrong answer0/225ms14464 KiB
7Wrong answer0/225ms14756 KiB
8Wrong answer0/225ms15000 KiB
9Wrong answer0/226ms14888 KiB
10Wrong answer0/224ms15128 KiB
11Wrong answer0/297ms35620 KiB
12Wrong answer0/293ms35540 KiB
13Wrong answer0/297ms36188 KiB
14Wrong answer0/294ms35936 KiB
15Wrong answer0/293ms36160 KiB
16Wrong answer0/292ms36200 KiB
17Wrong answer0/292ms36220 KiB
18Wrong answer0/2101ms36016 KiB
19Wrong answer0/2103ms36168 KiB
20Wrong answer0/294ms36412 KiB
21Wrong answer0/297ms36324 KiB
22Wrong answer0/2100ms36292 KiB
23Wrong answer0/293ms36300 KiB
24Accepted2/2100ms36272 KiB
25Wrong answer0/2100ms36256 KiB
26Wrong answer0/2101ms36480 KiB
27Wrong answer0/294ms36404 KiB