120342024-11-25 15:55:29mártonágnesVirágos rét (50 pont)cpp17Time limit exceeded 28/50300ms752 KiB
#include <iostream>

using namespace std;

int main()
{
    int N, K, fele=0, db=0;
    cin >> N >> K;
    int A[N-1];
    for (int i=0; i<=N-1; i++)
    {
        cin >> A[i];
    }
    for (int j=0; j<=N-1; j++)
    {
        db=0;
        if (A[j]==1)
        {
            for (int k=j+1; k<=N-1; k++)
            {
                if (A[k]==1) {db++;
                if (db>=K-1) fele++;}
            }
        }

    }
    cout << fele;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base28/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Time limit exceeded0/0273ms568 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted2/21ms320 KiB
11Accepted3/32ms400 KiB
12Accepted2/21ms356 KiB
13Accepted3/31ms320 KiB
14Time limit exceeded0/2300ms568 KiB
15Time limit exceeded0/2300ms752 KiB
16Time limit exceeded0/3300ms568 KiB
17Time limit exceeded0/3287ms568 KiB
18Time limit exceeded0/3280ms568 KiB
19Accepted3/371ms568 KiB
20Time limit exceeded0/3282ms568 KiB
21Time limit exceeded0/3279ms568 KiB
22Time limit exceeded0/3280ms568 KiB