86832024-01-25 10:51:08qertendVirágos rét (50 pont)cpp17Wrong answer 42/5020ms3880 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 << (int) N*(N+1)/2;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted0/020ms2368 KiB
4Accepted2/23ms2392 KiB
5Accepted2/23ms2788 KiB
6Accepted2/23ms2768 KiB
7Accepted3/33ms2964 KiB
8Accepted3/32ms2904 KiB
9Accepted3/33ms3028 KiB
10Accepted2/23ms3164 KiB
11Accepted3/33ms3304 KiB
12Accepted2/23ms3552 KiB
13Accepted3/33ms3660 KiB
14Accepted2/218ms3548 KiB
15Wrong answer0/219ms3652 KiB
16Accepted3/320ms3736 KiB
17Accepted3/319ms3772 KiB
18Wrong answer0/320ms3744 KiB
19Accepted3/320ms3880 KiB
20Accepted3/320ms3748 KiB
21Accepted3/320ms3856 KiB
22Wrong answer0/320ms3856 KiB