20292022-12-15 11:58:30szabel26Fasor (40)cpp17Time limit exceeded 22/40300ms7700 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;
    }
    cout<<i-k+1;
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/03ms1760 KiB
2Accepted0/03ms2188 KiB
3Accepted2/22ms2236 KiB
4Accepted2/22ms2588 KiB
5Accepted2/22ms2700 KiB
6Accepted2/22ms2900 KiB
7Accepted2/22ms3088 KiB
8Accepted2/22ms3300 KiB
9Accepted2/23ms3536 KiB
10Accepted2/23ms3472 KiB
11Accepted2/23ms3480 KiB
12Accepted2/23ms3732 KiB
13Time limit exceeded0/2266ms3660 KiB
14Wrong answer0/23ms7700 KiB
15Time limit exceeded0/2300ms4428 KiB
16Time limit exceeded0/2229ms4252 KiB
17Time limit exceeded0/2273ms4764 KiB
18Time limit exceeded0/2245ms4264 KiB
19Time limit exceeded0/2256ms4072 KiB
20Wrong answer0/26ms5628 KiB
21Time limit exceeded0/2300ms4816 KiB
22Accepted2/218ms6476 KiB