83162024-01-14 17:47:23gyjazminVirágos rét (50 pont)cpp17Wrong answer 4/5019ms4188 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 = 1; i < s; i++) {
            vsz += ossz-s-i;
        }
        cout << vsz << endl;
    }
}

SubtaskSumTestVerdictTimeMemory
base4/50
1Wrong answer0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Wrong answer0/019ms2328 KiB
4Wrong answer0/23ms2548 KiB
5Accepted2/23ms2628 KiB
6Accepted2/23ms2812 KiB
7Wrong answer0/33ms3028 KiB
8Wrong answer0/33ms3244 KiB
9Wrong answer0/33ms3456 KiB
10Wrong answer0/23ms3428 KiB
11Wrong answer0/33ms3552 KiB
12Wrong answer0/23ms3760 KiB
13Wrong answer0/33ms3908 KiB
14Wrong answer0/217ms3944 KiB
15Wrong answer0/218ms3944 KiB
16Wrong answer0/319ms3944 KiB
17Wrong answer0/318ms3948 KiB
18Wrong answer0/319ms3952 KiB
19Wrong answer0/319ms3948 KiB
20Wrong answer0/319ms4076 KiB
21Wrong answer0/319ms4188 KiB
22Wrong answer0/319ms4064 KiB