86812024-01-25 10:45:42qertendVirágos rét (50 pont)cpp17Wrong answer 42/5020ms4636 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/03ms2056 KiB
2Accepted0/03ms2072 KiB
3Accepted0/020ms2284 KiB
4Accepted2/23ms2496 KiB
5Accepted2/23ms2716 KiB
6Accepted2/23ms2920 KiB
7Accepted3/33ms3132 KiB
8Accepted3/33ms3504 KiB
9Accepted3/33ms3596 KiB
10Accepted2/23ms3576 KiB
11Accepted3/33ms3776 KiB
12Accepted2/23ms3888 KiB
13Accepted3/33ms4100 KiB
14Accepted2/218ms4068 KiB
15Wrong answer0/218ms4072 KiB
16Accepted3/320ms4304 KiB
17Accepted3/319ms4284 KiB
18Wrong answer0/320ms4392 KiB
19Accepted3/319ms4516 KiB
20Accepted3/319ms4504 KiB
21Accepted3/320ms4636 KiB
22Wrong answer0/319ms4520 KiB