86782024-01-25 10:37:10qertendVirágos rét (50 pont)cpp17Wrong answer 42/5021ms3972 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/03ms1880 KiB
2Accepted0/03ms2124 KiB
3Accepted0/020ms2332 KiB
4Accepted2/23ms2520 KiB
5Accepted2/23ms2608 KiB
6Accepted2/23ms2820 KiB
7Accepted3/33ms2896 KiB
8Accepted3/33ms2912 KiB
9Accepted3/33ms2796 KiB
10Accepted2/23ms2936 KiB
11Accepted3/33ms2896 KiB
12Accepted2/23ms2900 KiB
13Accepted3/33ms3024 KiB
14Accepted2/218ms3128 KiB
15Wrong answer0/219ms3224 KiB
16Accepted3/320ms3344 KiB
17Accepted3/319ms3300 KiB
18Wrong answer0/321ms3432 KiB
19Accepted3/320ms3672 KiB
20Accepted3/320ms3880 KiB
21Accepted3/320ms3972 KiB
22Wrong answer0/319ms3876 KiB