125532024-12-22 20:40:44BucsMateHőségriadó (50 pont)cpp17Wrong answer 16/5023ms840 KiB
#include <iostream>

using namespace std;

int main()
{
    int N, K, L, F;
    int parSum[100001] = {};
    int temp, nrAlarm = 0;
    bool isAlarm = false;

    cin >> N >> K >> L >> F;
    for(int i = 1; i <= N; i++){
        cin >> temp;
        parSum[i] = parSum[i-1] + temp;
        if(i >= K && 1.0*(parSum[i] - parSum[i-K])/K > F && !isAlarm){
            isAlarm = true;
            nrAlarm++;
            continue;
        }
        if(i >= L && 1.0*(parSum[i] - parSum[i-L])/L < F && isAlarm){
            isAlarm = false;
        }
    }
    cout << nrAlarm << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/02ms568 KiB
2Wrong answer0/023ms788 KiB
3Accepted2/22ms568 KiB
4Accepted2/22ms756 KiB
5Accepted2/21ms568 KiB
6Accepted2/21ms568 KiB
7Wrong answer0/21ms568 KiB
8Accepted4/41ms568 KiB
9Accepted4/49ms792 KiB
10Wrong answer0/412ms840 KiB
11Wrong answer0/414ms568 KiB
12Wrong answer0/412ms792 KiB
13Wrong answer0/418ms792 KiB
14Wrong answer0/43ms568 KiB
15Wrong answer0/420ms792 KiB
16Wrong answer0/420ms788 KiB
17Wrong answer0/421ms796 KiB