65082023-12-05 12:54:37antiFasor (40)cpp14Time limit exceeded 20/40300ms4588 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;
                    h = j;
                }
            }
        }
        if (hiba) {
            hiba = false;
        }
        else {
            megoldas = i + 1;
            break;
        }
    }
    cout << megoldas << endl;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1684 KiB
2Accepted0/06ms2080 KiB
3Accepted2/22ms1940 KiB
4Accepted2/23ms2056 KiB
5Accepted2/23ms2272 KiB
6Accepted2/23ms2520 KiB
7Accepted2/23ms2756 KiB
8Accepted2/23ms2888 KiB
9Accepted2/24ms3056 KiB
10Accepted2/26ms3316 KiB
11Accepted2/27ms3592 KiB
12Accepted2/24ms3796 KiB
13Time limit exceeded0/2300ms3384 KiB
14Time limit exceeded0/2263ms3604 KiB
15Time limit exceeded0/2254ms4072 KiB
16Time limit exceeded0/2261ms4252 KiB
17Time limit exceeded0/2256ms4348 KiB
18Time limit exceeded0/2300ms4196 KiB
19Time limit exceeded0/2243ms4272 KiB
20Time limit exceeded0/2282ms3888 KiB
21Time limit exceeded0/2273ms4464 KiB
22Time limit exceeded0/2256ms4588 KiB