86792024-01-25 10:39:43qertendVirágos rét (50 pont)cpp17Wrong answer 42/5020ms3664 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;
    bool ret;
    for (int i = 0; i < retekSzama; i++) {
        cin >> ret;
        szabadRetek += ret;
    }
    int N = szabadRetek-K+1;
    if (szabadRetek >= K) cout << (N)*(N+1)/2 << "\n";
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2124 KiB
3Accepted0/019ms2304 KiB
4Accepted2/23ms2536 KiB
5Accepted2/23ms2760 KiB
6Accepted2/23ms2928 KiB
7Accepted3/33ms3108 KiB
8Accepted3/33ms3200 KiB
9Accepted3/33ms3192 KiB
10Accepted2/23ms3196 KiB
11Accepted3/33ms3316 KiB
12Accepted2/23ms3088 KiB
13Accepted3/33ms3092 KiB
14Accepted2/218ms3104 KiB
15Wrong answer0/218ms3132 KiB
16Accepted3/319ms3208 KiB
17Accepted3/319ms3360 KiB
18Wrong answer0/320ms3348 KiB
19Accepted3/319ms3452 KiB
20Accepted3/319ms3412 KiB
21Accepted3/320ms3536 KiB
22Wrong answer0/319ms3664 KiB