141232025-01-09 20:41:01EsVagyHőségriadó (50 pont)cpp17Wrong answer 16/5023ms764 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k, l, f;
    cin >> n >> k >> l >> f;
    vector<int> temps(n);
    for (int i = 0; i < n; i++) {
        int next;
        cin >> temps[i];
    }

    int start = f * k;
    int end = f * l;
    int start_sum = 0, end_sum = 0;
    for (int i = 0; i < k; i++) {
        start_sum += temps[i];
        if (i >= k - l)end_sum += temps[i];
    }

    int ans = 0;
    bool b = start_sum > start;
    if (b) {
        ans++;
    }

    for (int i = k; i < n; i++) {
        start_sum -= temps[i - k];
        start_sum += temps[i];
        end_sum += temps[i];
        if (i >= l) {
            end_sum -= temps[i - l];
            if (b && end_sum < end) {
                b = false;
                continue;
            }
        }
        if (!b && start_sum > start) {
            b = true;
            ans++;
        }
    }

    cout << ans << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/01ms316 KiB
2Wrong answer0/023ms564 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms388 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Accepted4/41ms316 KiB
9Accepted4/49ms572 KiB
10Wrong answer0/412ms564 KiB
11Wrong answer0/414ms756 KiB
12Wrong answer0/412ms568 KiB
13Wrong answer0/418ms564 KiB
14Wrong answer0/43ms376 KiB
15Wrong answer0/421ms568 KiB
16Wrong answer0/421ms764 KiB
17Wrong answer0/421ms564 KiB