89572024-02-08 01:43:03qertendVirágos rét (50 pont)cpp17Accepted 50/5020ms4380 KiB
#include <iostream>
using namespace std;

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

    long szabadRetek = 0;
    bool ret;
    for (int i = 0; i < retekSzama; i++) {
        cin >> ret;
        szabadRetek += ret;
    }
    long N = szabadRetek-K+1;
    if (szabadRetek >= K) cout << (N)*(N+1)/2;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms2024 KiB
2Accepted0/03ms2168 KiB
3Accepted0/020ms2416 KiB
4Accepted2/23ms2448 KiB
5Accepted2/23ms2644 KiB
6Accepted2/22ms2456 KiB
7Accepted3/32ms2452 KiB
8Accepted3/33ms2580 KiB
9Accepted3/33ms2836 KiB
10Accepted2/23ms2880 KiB
11Accepted3/33ms3124 KiB
12Accepted2/23ms3336 KiB
13Accepted3/33ms3436 KiB
14Accepted2/218ms3444 KiB
15Accepted2/219ms3684 KiB
16Accepted3/320ms3692 KiB
17Accepted3/319ms3724 KiB
18Accepted3/320ms3864 KiB
19Accepted3/320ms4116 KiB
20Accepted3/320ms4284 KiB
21Accepted3/320ms4248 KiB
22Accepted3/320ms4380 KiB