118652024-11-12 22:41:24turierikVirágos rét (50 pont)python3Time limit exceeded 28/50300ms8376 KiB
n, k = map(int, input().split())
r = [int(x) for x in input().split()]
x = 0

fi = []
for i in range(n):
    if r[i] == 1:
        fi.append(i)

for ii, i in enumerate(fi):
    y = 0
    for j in fi[ii:]:
        if r[j] == 1:
            y += 1
            if y >= k:
                x += 1
print(x)
SubtaskSumTestVerdictTimeMemory
base28/50
1Accepted0/016ms3128 KiB
2Accepted0/016ms3128 KiB
3Time limit exceeded0/0286ms4860 KiB
4Accepted2/216ms3128 KiB
5Accepted2/216ms3128 KiB
6Accepted2/216ms3128 KiB
7Accepted3/316ms3128 KiB
8Accepted3/317ms3196 KiB
9Accepted3/314ms3052 KiB
10Accepted2/216ms3140 KiB
11Accepted3/3133ms3128 KiB
12Accepted2/248ms3124 KiB
13Accepted3/330ms3064 KiB
14Time limit exceeded0/2282ms8372 KiB
15Time limit exceeded0/2300ms8168 KiB
16Time limit exceeded0/3279ms6020 KiB
17Time limit exceeded0/3300ms4832 KiB
18Time limit exceeded0/3291ms6996 KiB
19Accepted3/3177ms4964 KiB
20Time limit exceeded0/3289ms7764 KiB
21Time limit exceeded0/3300ms5196 KiB
22Time limit exceeded0/3282ms8376 KiB