20312022-12-15 12:07:42szabel26Fasor (40)cpp17Forditási hiba
#include <iostream>
#include <vector>
//#include <fstream>

using namespace std;

//ifstream cin("fasor.in");
//ofstream cout("fasor.out");

vector<int>x;

int a,i,n,j,k;
bool megfel=true;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k;
    x.resize(n+2*k);
    for (i = k; i <= n; ++i)
    {
        cin>>a;
        x[i]=a;
    }
    for(i = k; i <= n; ++i)
    {
        for (j = 1; j <= k; ++j)
        {
            if(x[i+j]<=x[i] && x[i-j]<=x[i]) megfel=true;
                    else
                    {
                        megfel=false;
                        break;
                    }
        }
        if(megfel) break;
            else continue;
    }
    if (megfel) cout<<i-k+1;
        else cout<<"-1"
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:42:24: error: expected ';' before '}' token
   42 |         else cout<<"-1"
      |                        ^
      |                        ;
   43 | }
      | ~                       
Exited with error status 1