117252024-11-08 10:14:09MrChipserVirágos rét (50 pont)cpp17Accepted 50/5018ms508 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    int v = 0;
    long sz = 0;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if(a==1)
        {
            v++;
            if(v-k+1>0)
                sz+=v-k+1;
        }
    }
    cout << sz;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms508 KiB
2Accepted0/01ms320 KiB
3Accepted0/017ms508 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted2/21ms320 KiB
11Accepted3/31ms400 KiB
12Accepted2/21ms320 KiB
13Accepted3/31ms320 KiB
14Accepted2/216ms408 KiB
15Accepted2/217ms400 KiB
16Accepted3/317ms404 KiB
17Accepted3/317ms404 KiB
18Accepted3/317ms396 KiB
19Accepted3/317ms320 KiB
20Accepted3/317ms504 KiB
21Accepted3/318ms400 KiB
22Accepted3/317ms404 KiB