64172023-11-28 19:12:05antiFasor (40)cpp14Time limit exceeded 20/40300ms4980 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;
    bool hiba = false;
    for (int i = 0; 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;
            }
        }
        if (hiba) {
            hiba = false;
        }
        else {
            megoldas = i + 1;
            break;
        }
    }
    cout << megoldas << endl;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1684 KiB
2Accepted0/06ms2308 KiB
3Accepted2/23ms2324 KiB
4Accepted2/23ms2536 KiB
5Accepted2/23ms2756 KiB
6Accepted2/23ms2880 KiB
7Accepted2/23ms3104 KiB
8Accepted2/23ms3188 KiB
9Accepted2/26ms3372 KiB
10Accepted2/26ms3324 KiB
11Accepted2/26ms3584 KiB
12Accepted2/24ms3540 KiB
13Time limit exceeded0/2300ms3464 KiB
14Time limit exceeded0/2282ms3680 KiB
15Time limit exceeded0/2273ms4244 KiB
16Time limit exceeded0/2266ms4356 KiB
17Time limit exceeded0/2282ms4420 KiB
18Time limit exceeded0/2250ms4480 KiB
19Time limit exceeded0/2252ms4620 KiB
20Time limit exceeded0/2257ms4312 KiB
21Time limit exceeded0/2270ms4900 KiB
22Time limit exceeded0/2266ms4980 KiB