98682024-03-13 16:19:05VargusVirágos rét (50 pont)cpp17Wrong answer 2/5021ms6368 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;

int rek(ll n)
{
    if (n == 0)
        return 0;
    return n + rek(n - 1);
}

int main()
{
    ll n, m, k;
    cin >> n >> m;
    vector <ll> a;
    for (ll i = 1; i <= n; ++i)
    {
        cin >> k;
        if (k == 1)
            a.push_back(k);
    }
    if (a.size() < 3)
    {
        cout << "0";
        return 0;
    }
    if (rek(a.size() - 2) >= m)
        cout << rek(a.size() - 2);
    else
        cout << "0";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/03ms1684 KiB
2Accepted0/03ms1848 KiB
3Wrong answer0/019ms2484 KiB
4Wrong answer0/23ms2140 KiB
5Accepted2/23ms2268 KiB
6Wrong answer0/23ms2468 KiB
7Wrong answer0/33ms2704 KiB
8Wrong answer0/33ms2948 KiB
9Wrong answer0/33ms3104 KiB
10Wrong answer0/22ms3216 KiB
11Wrong answer0/33ms3320 KiB
12Wrong answer0/23ms3428 KiB
13Wrong answer0/33ms3408 KiB
14Wrong answer0/219ms5548 KiB
15Wrong answer0/219ms5768 KiB
16Wrong answer0/320ms4952 KiB
17Wrong answer0/319ms4432 KiB
18Wrong answer0/321ms5976 KiB
19Wrong answer0/319ms4044 KiB
20Wrong answer0/320ms6292 KiB
21Wrong answer0/320ms5460 KiB
22Wrong answer0/320ms6368 KiB