65092023-12-05 13:00:55antiFasor (40)cpp14Time limit exceeded 20/40300ms4044 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, d;
    cin >> n >> d;
    vector<int> F;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        F.push_back(a);
    }
    int megoldas = -1, h=0;
    bool hiba = false;
    for (int i = h; i < n; i++) {
        for (int j = i - d; j <= i + d; j++) {
            if (j > 0 and j < n) {
                if (F[j] > F[i]){
                    hiba = true;
                    break;
                }
            }
        }
        if (hiba) {
            hiba = false;
        }
        else {
            megoldas = i + 1;
            break;
        }
    }
    cout << megoldas << endl;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1692 KiB
2Accepted0/04ms2156 KiB
3Accepted2/23ms2136 KiB
4Accepted2/22ms2144 KiB
5Accepted2/22ms2144 KiB
6Accepted2/22ms2148 KiB
7Accepted2/23ms2288 KiB
8Accepted2/23ms2504 KiB
9Accepted2/26ms2956 KiB
10Accepted2/26ms3028 KiB
11Accepted2/26ms2900 KiB
12Accepted2/24ms3156 KiB
13Time limit exceeded0/2300ms2928 KiB
14Time limit exceeded0/2270ms3144 KiB
15Time limit exceeded0/2250ms3756 KiB
16Time limit exceeded0/2241ms3724 KiB
17Time limit exceeded0/2266ms3744 KiB
18Time limit exceeded0/2257ms3724 KiB
19Time limit exceeded0/2246ms3940 KiB
20Time limit exceeded0/2270ms3408 KiB
21Time limit exceeded0/2238ms3900 KiB
22Time limit exceeded0/2275ms4044 KiB