84832024-01-17 15:41:54petergalambosVirágos rét (50 pont)python3Accepted 50/5041ms16928 KiB
from sys import stdin

N, K = [int(i) for i in input().split()]
R = [int(i) for i in stdin.readline().split()].count(1)
if R < K:
    print(0)
else:
    print((R-K+1)*(R-K+2)//2)
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11008 KiB
2Accepted0/017ms11332 KiB
3Accepted0/041ms15100 KiB
4Accepted2/217ms11568 KiB
5Accepted2/217ms11820 KiB
6Accepted2/217ms12204 KiB
7Accepted3/317ms11932 KiB
8Accepted3/317ms12000 KiB
9Accepted3/317ms12264 KiB
10Accepted2/217ms12456 KiB
11Accepted3/317ms12752 KiB
12Accepted2/217ms12652 KiB
13Accepted3/317ms13028 KiB
14Accepted2/237ms16320 KiB
15Accepted2/239ms16224 KiB
16Accepted3/341ms16928 KiB
17Accepted3/341ms16088 KiB
18Accepted3/341ms16732 KiB
19Accepted3/341ms16692 KiB
20Accepted3/339ms16684 KiB
21Accepted3/341ms16796 KiB
22Accepted3/339ms16860 KiB