74862024-01-09 10:25:04BenedekMartonFasor (40)cpp17Time limit exceeded 22/40300ms5048 KiB
#include <iostream>
#include <queue>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int t[n];
    bool l=1;
    for(int i=0; i<n; i++)
    {
        cin >> t[i];
    }
    for(int i=0; i<k; i++)
    {
        l=1;
        for(int j=0; j<=i+k and l; j++)
        {
            if(t[i]<t[j])
            {
                l=0;
            }
        }
        if(l)
        {
            cout << i+1;
            return 0;
        }
    }
    for(int i=k; i<n; i++)
    {
        l=1;
        for(int j=i-k; j<=i+k and j<n and l; j++)
        {
            if(t[i]<t[j])
            {
                l=0;
            }
        }
        if(l)
        {
            cout << i+1;
            return 0;
        }
    }
    cout << -1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/03ms1876 KiB
2Accepted0/04ms2152 KiB
3Accepted2/23ms2284 KiB
4Accepted2/23ms2680 KiB
5Accepted2/23ms2712 KiB
6Accepted2/23ms2992 KiB
7Accepted2/23ms2868 KiB
8Accepted2/23ms3000 KiB
9Accepted2/26ms3392 KiB
10Accepted2/26ms3344 KiB
11Accepted2/26ms3348 KiB
12Accepted2/24ms3320 KiB
13Time limit exceeded0/2300ms2828 KiB
14Time limit exceeded0/2268ms2824 KiB
15Time limit exceeded0/2256ms3276 KiB
16Time limit exceeded0/2264ms3280 KiB
17Time limit exceeded0/2230ms3392 KiB
18Time limit exceeded0/2273ms3276 KiB
19Time limit exceeded0/2296ms3400 KiB
20Time limit exceeded0/2277ms3068 KiB
21Time limit exceeded0/2252ms3488 KiB
22Accepted2/275ms5048 KiB