86772024-01-25 10:33:01qertendVirágos rét (50 pont)cpp17Wrong answer 42/5020ms4080 KiB
#include <iostream>
using namespace std;

/**
 * Fails on njduge tests 15, 18, 22
*/
int main()
{
    int retekSzama, K;
    cin >> retekSzama;
    cin >> K;

    int szabadRetek = 0;
    int ret;
    for (int i = 0; i < retekSzama; i++) {
        cin >> ret;
        if (ret == 1) szabadRetek++;
    }
    int N = szabadRetek-K+1;
    if (szabadRetek >= K) cout << (N)*(N+1)/2;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1744 KiB
2Accepted0/03ms1992 KiB
3Accepted0/019ms2236 KiB
4Accepted2/23ms2364 KiB
5Accepted2/23ms2620 KiB
6Accepted2/22ms2700 KiB
7Accepted3/33ms2664 KiB
8Accepted3/33ms2764 KiB
9Accepted3/33ms2976 KiB
10Accepted2/23ms3188 KiB
11Accepted3/33ms3276 KiB
12Accepted2/23ms3400 KiB
13Accepted3/33ms3516 KiB
14Accepted2/218ms3640 KiB
15Wrong answer0/218ms3728 KiB
16Accepted3/319ms3852 KiB
17Accepted3/318ms3732 KiB
18Wrong answer0/320ms3728 KiB
19Accepted3/319ms3852 KiB
20Accepted3/319ms3892 KiB
21Accepted3/319ms3884 KiB
22Wrong answer0/319ms4080 KiB