82622024-01-13 21:16:00bovizdbHőségriadó (50 pont)csharpForditási hiba
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define endl "\n"
#define pll pair<ll, ll>
#define fs first
#define sc second
#define vll vector<ll>
#define v2d vector<vector<ll>>
#define vpll vector<pll>
#define qll queue<ll>
#define stll stack<ll>
#define sll set<ll>
#define mll map<ll, ll>

ll n, k, l, f;
vll v;

void solve()
{
    cin >> n >> k >> l >> f;
    v.resize(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    ll klen = 0, llen = 0, out = 0;
    bool b = 0;
    for (ll i = 0; i < n; i++)
    {
        if (v[i] == f)
        {
            llen = 0;
            klen = 0;
            continue;
        }
        if (b == 1 && llen >= l)
        {
            b = 0;
        }
        if (klen >= k && b == 0)
        {
            b = 1;
            out++;
        }
        if (v[i] > f)
        {
            llen = 0;
            klen++;
        }
        else if (v[i] < f)
        {
            klen = 0;
            llen++;
        }
    }
    if (klen >= k && b == 0)
    {
        b = 1;
        out++;
    }
    cout << out;
}
 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
Forditási hiba
exit status 1
main.cs(2,0): error CS1024: Wrong preprocess