121582024-12-05 13:22:33horichdominik2Virágos rét (50 pont)python3Time limit exceeded 15/50300ms4960 KiB
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

utakSzama = 0
elozoStart = 0

kesz = 0

while (not kesz):

    start = 0
    megjartRetek = 0
    for i in range(elozoStart+1, n):
        if(p[i] == 1):
            start = i
            break
    
    if(elozoStart > start): break
    #print("start", start+1)

    for i in range(start, n, 1):
        if(p[i] == 1):
            megjartRetek += 1
        if(megjartRetek >= k and p[i] == 1):
            #print("fasza, end:", i+1)
            #print("megjartretek:", megjartRetek)
            utakSzama += 1

    if(elozoStart+1 == n): kesz = 1
    elozoStart = start
    
print(utakSzama)
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/016ms3128 KiB
2Accepted0/016ms3124 KiB
3Time limit exceeded0/0279ms4952 KiB
4Wrong answer0/216ms3128 KiB
5Time limit exceeded0/2284ms2864 KiB
6Accepted2/217ms3128 KiB
7Accepted3/316ms3128 KiB
8Accepted3/316ms3312 KiB
9Wrong answer0/316ms3128 KiB
10Accepted2/217ms3312 KiB
11Wrong answer0/3164ms2928 KiB
12Accepted2/282ms3120 KiB
13Accepted3/352ms3060 KiB
14Time limit exceeded0/2284ms4584 KiB
15Time limit exceeded0/2300ms4560 KiB
16Time limit exceeded0/3300ms4844 KiB
17Time limit exceeded0/3300ms4620 KiB
18Time limit exceeded0/3282ms4896 KiB
19Time limit exceeded0/3300ms4828 KiB
20Time limit exceeded0/3300ms4920 KiB
21Time limit exceeded0/3300ms4916 KiB
22Time limit exceeded0/3287ms4960 KiB