86982024-01-25 17:47:43AzukitsuÚthasználati díj (75 pont)cpp17Accepted 75/7519ms4160 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> varosok(N, 0);
    for (int i = 0; i < N; i++) cin >> varosok[i];
    int jok = count(varosok.begin(), varosok.end(), 1);
    int sum = 0;
    for (int i = 2; i <= jok && i <= K; i++) {
        sum += jok - i + 1;
    }
    cout << sum;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1812 KiB
2Accepted0/03ms2060 KiB
3Accepted0/019ms2848 KiB
4Accepted5/53ms2216 KiB
5Accepted5/53ms2432 KiB
6Accepted5/53ms2660 KiB
7Accepted5/53ms2724 KiB
8Accepted5/52ms2720 KiB
9Accepted5/53ms2724 KiB
10Accepted5/53ms2720 KiB
11Accepted5/53ms2860 KiB
12Accepted5/53ms3100 KiB
13Accepted5/53ms3280 KiB
14Accepted5/519ms4068 KiB
15Accepted5/519ms4068 KiB
16Accepted5/519ms4160 KiB
17Accepted5/519ms4068 KiB
18Accepted5/519ms4156 KiB