25702023-01-17 15:20:27NandikaaFasor (40)cpp11Time limit exceeded 20/40300ms4224 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    int d;
    cin >> n;
    cin >> d;
    int fasor [n];
    for (int i = 0; i< n;i++){
        cin >> fasor[i];
    }
    bool rosszhely;
    for (int i = 0; i < n; i++){
        rosszhely=false;
        for (int j=i-d; j <= i+d;j++){
            if (j >= 0 && j<n){
            if (fasor[j] > fasor[i]){
                rosszhely = true;
                break;
                }
            }
        }
        if (rosszhely == false){
            cout << i+1;
            return 0;
        }
    }
    cout << "-1";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1872 KiB
2Accepted0/04ms2284 KiB
3Accepted2/22ms2236 KiB
4Accepted2/22ms2280 KiB
5Accepted2/22ms2480 KiB
6Accepted2/22ms2516 KiB
7Accepted2/22ms2592 KiB
8Accepted2/23ms2716 KiB
9Accepted2/24ms2956 KiB
10Accepted2/26ms3164 KiB
11Accepted2/26ms3236 KiB
12Accepted2/24ms3236 KiB
13Time limit exceeded0/2300ms2916 KiB
14Time limit exceeded0/2264ms3052 KiB
15Time limit exceeded0/2245ms3684 KiB
16Time limit exceeded0/2264ms3888 KiB
17Time limit exceeded0/2254ms3808 KiB
18Time limit exceeded0/2254ms3788 KiB
19Time limit exceeded0/2270ms3812 KiB
20Time limit exceeded0/2256ms3540 KiB
21Time limit exceeded0/2268ms4116 KiB
22Time limit exceeded0/2266ms4224 KiB