38462023-03-03 11:33:33AGergoFasor (40)cpp17Time limit exceeded 20/40266ms5004 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //iostream.sync_with_stdio(false);
    cin.tie(0);

    int szam;
    int lat;
    cin >> szam >> lat;

    vector<int> fak( szam + 2*lat + 1,-1);

    for (int i = 0; i < szam; i++)
    {
        cin >> fak[i + lat];
    }

    int temp = 0;
    for(int i = lat; i < szam + lat; i++)
    {
        temp =0;
        for(int j = -lat; j < lat +1; j++)
        {

            if(fak[i + j] > fak[i])
            {
                break;
            }
            else
            {
                temp++;
            }
        }

        if(temp == 2 * lat + 1)
        {
            cout << i - lat + 1 ;
            break;
        }
    }

    if(temp != 2*lat +1)
    {
        cout << -1;
    }

}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1808 KiB
2Accepted0/04ms2224 KiB
3Accepted2/22ms2144 KiB
4Accepted2/22ms2120 KiB
5Accepted2/23ms2316 KiB
6Accepted2/23ms2528 KiB
7Accepted2/23ms2612 KiB
8Accepted2/23ms2864 KiB
9Accepted2/24ms3256 KiB
10Accepted2/26ms3348 KiB
11Accepted2/26ms3288 KiB
12Accepted2/24ms3540 KiB
13Time limit exceeded0/2224ms3184 KiB
14Time limit exceeded0/2259ms4940 KiB
15Time limit exceeded0/2218ms4628 KiB
16Time limit exceeded0/2231ms4248 KiB
17Time limit exceeded0/2266ms4516 KiB
18Time limit exceeded0/2263ms4252 KiB
19Time limit exceeded0/2246ms4064 KiB
20Time limit exceeded0/2238ms4088 KiB
21Time limit exceeded0/2250ms5004 KiB
22Time limit exceeded0/2238ms4620 KiB