84792024-01-17 15:22:02petergalambosVirágos rét (50 pont)python3Wrong answer 48/5064ms17944 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 < 2:
    print(0)
else:
    i = R-K+1
    S = i
    while i > 0:
        i -= 1
        S += i
    
##    S = (R-K+1)*(R-K+2)//2
    print(S)
SubtaskSumTestVerdictTimeMemory
base48/50
1Accepted0/018ms11508 KiB
2Accepted0/017ms11900 KiB
3Accepted0/045ms15696 KiB
4Accepted2/217ms12324 KiB
5Accepted2/217ms12576 KiB
6Wrong answer0/217ms12684 KiB
7Accepted3/317ms12780 KiB
8Accepted3/317ms12448 KiB
9Accepted3/317ms12820 KiB
10Accepted2/217ms13328 KiB
11Accepted3/318ms13288 KiB
12Accepted2/217ms13716 KiB
13Accepted3/318ms13596 KiB
14Accepted2/239ms16808 KiB
15Accepted2/264ms16876 KiB
16Accepted3/350ms17744 KiB
17Accepted3/343ms17172 KiB
18Accepted3/361ms17476 KiB
19Accepted3/341ms17944 KiB
20Accepted3/345ms17868 KiB
21Accepted3/352ms17816 KiB
22Accepted3/364ms17884 KiB