211222026-01-12 12:16:54szabel26Virágos rét (50 pont)cpp17Wrong answer 9/5018ms1440 KiB
#include <iostream>
#include <vector>
using namespace std;

int n, k, i, db;
vector<int> x, y;

int main()
{
    cin >> n >> k;

    x.resize(n + 1);

    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
        if (x[i] == 1)
        {
            ++db;
            y.push_back(i);
        }
    }

    if (db < k)
    {
        cout << 0;
        return 0;
    }
    else if (db == k)
    {
        cout << 1;
        return 0;
    }

    db = 0;
    for (i = 0; i < y.size() - 2; ++i)
    {
        db += y.size() - (i + 2);
    }

    cout << db;
}
SubtaskSumTestVerdictTimeMemory
base9/50
1Accepted0/01ms508 KiB
2Accepted0/01ms316 KiB
3Wrong answer0/018ms912 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Accepted3/31ms508 KiB
9Wrong answer0/31ms560 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/31ms316 KiB
12Wrong answer0/21ms316 KiB
13Wrong answer0/31ms408 KiB
14Accepted2/217ms1200 KiB
15Wrong answer0/217ms1200 KiB
16Wrong answer0/318ms1100 KiB
17Wrong answer0/317ms892 KiB
18Wrong answer0/318ms1440 KiB
19Wrong answer0/317ms804 KiB
20Wrong answer0/318ms1404 KiB
21Wrong answer0/318ms1188 KiB
22Wrong answer0/318ms1200 KiB