83192024-01-14 17:51:23gyjazminVirágos rét (50 pont)cpp17Wrong answer 42/5020ms4128 KiB
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <numeric>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    //vector<int> reteksz;
    int ossz = 0;
    for (int i = 0; i < n; i++) {
        int cv;
        cin >> cv;
        if (cv == 1) {
            ossz++;
            //reteksz.push_back(i + 1);
        }
    }
    int s = ossz - k + 1;
    int vsz = 0;
    if (ossz < k) {
        cout << 0 << endl;
    }
    /*else if (s == 0) {
        cout << 1 << endl;
    }*/
    else {
        for (int i = 0; i < s; i++) {
            vsz += s-i;
        }
        cout << vsz << endl;
    }
}

SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2116 KiB
3Accepted0/019ms2332 KiB
4Accepted2/23ms2560 KiB
5Accepted2/23ms2624 KiB
6Accepted2/23ms2736 KiB
7Accepted3/33ms2832 KiB
8Accepted3/33ms2920 KiB
9Accepted3/33ms3008 KiB
10Accepted2/23ms3132 KiB
11Accepted3/33ms3348 KiB
12Accepted2/23ms3428 KiB
13Accepted3/33ms3432 KiB
14Accepted2/218ms3432 KiB
15Wrong answer0/218ms3700 KiB
16Accepted3/319ms3664 KiB
17Accepted3/319ms3812 KiB
18Wrong answer0/319ms3820 KiB
19Accepted3/319ms3884 KiB
20Accepted3/319ms3884 KiB
21Accepted3/320ms4008 KiB
22Wrong answer0/319ms4128 KiB