28512023-01-29 21:17:07kristofLeggyorsabb pénzkeresés (50)python3Wrong answer 2/50105ms36444 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
eddigiNapok = 0
for i in range(n):
    eddigiSzam = prefixArr[i]
    while eddigiSzam >= k:
        eddigiSzam -= prefixArr[l]
        l += 1
        if eddigiSzam == k:
            print(i-l+1)

SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/017ms11040 KiB
2Wrong answer0/092ms34096 KiB
3Wrong answer0/217ms11644 KiB
4Accepted2/217ms11788 KiB
5Wrong answer0/217ms11916 KiB
6Wrong answer0/225ms14484 KiB
7Wrong answer0/224ms14812 KiB
8Wrong answer0/225ms14808 KiB
9Wrong answer0/225ms15196 KiB
10Wrong answer0/225ms15272 KiB
11Wrong answer0/2101ms35636 KiB
12Wrong answer0/2101ms35688 KiB
13Wrong answer0/294ms35880 KiB
14Wrong answer0/2101ms35972 KiB
15Wrong answer0/297ms35680 KiB
16Wrong answer0/2103ms35832 KiB
17Wrong answer0/293ms35748 KiB
18Wrong answer0/297ms35924 KiB
19Wrong answer0/297ms36040 KiB
20Wrong answer0/292ms36344 KiB
21Wrong answer0/293ms36272 KiB
22Wrong answer0/296ms36392 KiB
23Wrong answer0/296ms36216 KiB
24Wrong answer0/293ms36400 KiB
25Wrong answer0/2105ms36360 KiB
26Wrong answer0/2104ms36444 KiB
27Wrong answer0/296ms36372 KiB