20322022-12-15 12:08:17szabel26Fasor (40)cpp17Time limit exceeded 22/40300ms7500 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()
{
    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";
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/03ms1888 KiB
2Accepted0/03ms2252 KiB
3Accepted2/22ms2156 KiB
4Accepted2/22ms2296 KiB
5Accepted2/22ms2500 KiB
6Accepted2/22ms2708 KiB
7Accepted2/22ms2804 KiB
8Accepted2/22ms2940 KiB
9Accepted2/23ms3056 KiB
10Accepted2/23ms3320 KiB
11Accepted2/23ms3516 KiB
12Accepted2/23ms3700 KiB
13Time limit exceeded0/2300ms3568 KiB
14Wrong answer0/24ms7500 KiB
15Time limit exceeded0/2268ms4356 KiB
16Time limit exceeded0/2261ms4100 KiB
17Time limit exceeded0/2256ms4608 KiB
18Time limit exceeded0/2273ms4212 KiB
19Time limit exceeded0/2261ms4048 KiB
20Wrong answer0/26ms5660 KiB
21Time limit exceeded0/2300ms4832 KiB
22Accepted2/219ms6360 KiB