65102023-12-05 13:01:59antiFasor (40)cpp14Time limit exceeded 20/40300ms5112 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;
                    continue;
                }
            }
        }
        if (hiba) {
            hiba = false;
        }
        else {
            megoldas = i + 1;
            break;
        }
    }
    cout << megoldas << endl;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1812 KiB
2Accepted0/06ms2288 KiB
3Accepted2/23ms2216 KiB
4Accepted2/23ms2460 KiB
5Accepted2/23ms2700 KiB
6Accepted2/23ms3032 KiB
7Accepted2/23ms3200 KiB
8Accepted2/23ms3436 KiB
9Accepted2/26ms3492 KiB
10Accepted2/26ms3752 KiB
11Accepted2/27ms4000 KiB
12Accepted2/24ms4080 KiB
13Time limit exceeded0/2300ms3812 KiB
14Time limit exceeded0/2270ms4048 KiB
15Time limit exceeded0/2270ms4420 KiB
16Time limit exceeded0/2254ms4608 KiB
17Time limit exceeded0/2266ms4692 KiB
18Time limit exceeded0/2270ms4708 KiB
19Time limit exceeded0/2266ms4900 KiB
20Time limit exceeded0/2257ms4168 KiB
21Time limit exceeded0/2257ms4908 KiB
22Time limit exceeded0/2254ms5112 KiB