137902025-01-08 18:14:34csalamihalyVirágos rét (50 pont)cpp17Time limit exceeded 30/50300ms732 KiB
#include<iostream>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int retek [n+1];
    for (int i=1; i<=n; i++)
        cin >> retek[i];
    int db = 0;
    int talalt = 0;
    for (int i = 1; i<=n-k+1; i++)
    {
        if (retek[i] == 1)
        {
            for (int j = i; j<=n; j++)
            {
                if (retek[j] == 1)
                {
                    talalt += 1;
                    if (talalt >= k) db++;
                }
            }
            talalt = 0;
        }
    }
    cout << db << endl;

}
SubtaskSumTestVerdictTimeMemory
base30/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Time limit exceeded0/0284ms564 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted2/21ms316 KiB
11Accepted3/32ms316 KiB
12Accepted2/21ms316 KiB
13Accepted3/31ms316 KiB
14Accepted2/217ms664 KiB
15Time limit exceeded0/2300ms732 KiB
16Time limit exceeded0/3300ms616 KiB
17Time limit exceeded0/3279ms564 KiB
18Time limit exceeded0/3275ms564 KiB
19Accepted3/371ms564 KiB
20Time limit exceeded0/3280ms568 KiB
21Time limit exceeded0/3300ms544 KiB
22Time limit exceeded0/3279ms564 KiB