98662024-03-13 15:56:36VargusVirágos rét (50 pont)cpp17Time limit exceeded 2/50300ms5296 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;
ll db;

int main()
{
    ll n, m;
    cin >> n >> m;
    vector <ll> a(n + 1);
    for (ll i = 1; i <= n; ++i)
    {
        cin >> a[i];
    }
    bool ok;
    for (ll i = 1; i <= n - 1; ++i)
    {
        ok = false;
        if (a[i] == 1)
        {
            for (ll j = i + 1; j <= n; ++j)
            {
                if (ok == 1 && a[j] == 1)
                    ++db;
                if (a[j] == 1)
                    ok = true;
            }
        }
    }
    if (db >= m)
        cout << db;
    else
        cout << "0";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/03ms1812 KiB
2Accepted0/03ms2008 KiB
3Time limit exceeded0/0300ms2308 KiB
4Wrong answer0/23ms2476 KiB
5Accepted2/23ms2724 KiB
6Wrong answer0/23ms2764 KiB
7Wrong answer0/32ms2768 KiB
8Wrong answer0/33ms2736 KiB
9Wrong answer0/33ms2736 KiB
10Wrong answer0/23ms2860 KiB
11Wrong answer0/34ms3108 KiB
12Wrong answer0/23ms3100 KiB
13Wrong answer0/33ms3232 KiB
14Time limit exceeded0/2300ms3420 KiB
15Time limit exceeded0/2248ms3736 KiB
16Time limit exceeded0/3273ms3880 KiB
17Time limit exceeded0/3230ms3688 KiB
18Time limit exceeded0/3266ms3968 KiB
19Wrong answer0/376ms5296 KiB
20Time limit exceeded0/3259ms4080 KiB
21Time limit exceeded0/3261ms4300 KiB
22Time limit exceeded0/3261ms4208 KiB