86822024-01-25 10:46:31qertendVirágos rét (50 pont)cpp17Wrong answer 42/5020ms4128 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;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1872 KiB
2Accepted0/03ms2120 KiB
3Accepted0/020ms2336 KiB
4Accepted2/23ms2576 KiB
5Accepted2/23ms2792 KiB
6Accepted2/23ms2968 KiB
7Accepted3/33ms3216 KiB
8Accepted3/33ms3400 KiB
9Accepted3/33ms3608 KiB
10Accepted2/23ms3692 KiB
11Accepted3/33ms3688 KiB
12Accepted2/23ms3696 KiB
13Accepted3/33ms3816 KiB
14Accepted2/218ms3912 KiB
15Wrong answer0/219ms3904 KiB
16Accepted3/320ms3900 KiB
17Accepted3/319ms4044 KiB
18Wrong answer0/320ms4128 KiB
19Accepted3/320ms4124 KiB
20Accepted3/320ms4128 KiB
21Accepted3/320ms4124 KiB
22Wrong answer0/320ms4124 KiB