143492025-01-10 17:05:57MittomenVirágos rét (50 pont)cpp17Wrong answer 4/5018ms508 KiB
#include <list>
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>

using namespace std;

int main() {

    int n, k;
    cin >> n >> k;

    int true_fields = 0;
    for (int i = 0; i < n; i++) {
        bool field;
        cin >> field;

        if (field) true_fields++;
    }

    cout << max((true_fields - k + 1) * 2, 0);

    return 0;
}

// m - k, m - k - 1, 1
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/01ms500 KiB
2Accepted0/01ms316 KiB
3Wrong answer0/018ms404 KiB
4Wrong answer0/21ms508 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/31ms392 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/31ms316 KiB
12Wrong answer0/21ms316 KiB
13Wrong answer0/31ms316 KiB
14Wrong answer0/217ms400 KiB
15Wrong answer0/217ms404 KiB
16Wrong answer0/317ms396 KiB
17Wrong answer0/317ms400 KiB
18Wrong answer0/318ms400 KiB
19Wrong answer0/317ms392 KiB
20Wrong answer0/317ms400 KiB
21Wrong answer0/318ms404 KiB
22Wrong answer0/317ms332 KiB