20282022-12-15 11:55:18szabel26Fasor (40)cpp17Time limit exceeded 22/40300ms8272 KiB
#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()
{
    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;
    }
    cout<<i-k+1;
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/03ms1876 KiB
2Accepted0/04ms2160 KiB
3Accepted2/22ms2320 KiB
4Accepted2/22ms2480 KiB
5Accepted2/22ms2680 KiB
6Accepted2/22ms2880 KiB
7Accepted2/22ms3132 KiB
8Accepted2/23ms3344 KiB
9Accepted2/24ms3440 KiB
10Accepted2/26ms3532 KiB
11Accepted2/26ms3740 KiB
12Accepted2/24ms3836 KiB
13Time limit exceeded0/2243ms4012 KiB
14Wrong answer0/24ms8272 KiB
15Time limit exceeded0/2300ms5184 KiB
16Time limit exceeded0/2256ms4868 KiB
17Time limit exceeded0/2264ms4948 KiB
18Time limit exceeded0/2233ms4568 KiB
19Time limit exceeded0/2248ms4392 KiB
20Wrong answer0/213ms5964 KiB
21Time limit exceeded0/2300ms5476 KiB
22Accepted2/259ms6948 KiB