65112023-12-05 13:09:13antiFasor (40)cpp14Time limit exceeded 20/40300ms5092 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, maxi=0;
    bool hiba = false;
    for (int i = maxi; i < n; i++) {
        for (int j = i; j <= i + d; j++) {
            if (j < n) {
                if (F[j] > F[i]){
                    maxi = F[j];
                    hiba = true;
                }
            }
        }
        if (hiba) {
            hiba = false;
        }
        else {
            megoldas = i + 1;
            break;
        }
    }
    cout << megoldas << endl;
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/03ms1808 KiB
2Accepted0/04ms2292 KiB
3Accepted2/23ms2264 KiB
4Accepted2/23ms2480 KiB
5Accepted2/23ms2640 KiB
6Accepted2/23ms2848 KiB
7Accepted2/23ms3072 KiB
8Accepted2/23ms3284 KiB
9Accepted2/26ms3720 KiB
10Accepted2/26ms3932 KiB
11Accepted2/26ms3888 KiB
12Accepted2/24ms3888 KiB
13Time limit exceeded0/2300ms3740 KiB
14Time limit exceeded0/2261ms3840 KiB
15Time limit exceeded0/2277ms4384 KiB
16Time limit exceeded0/2241ms4368 KiB
17Time limit exceeded0/2261ms4552 KiB
18Time limit exceeded0/2256ms4752 KiB
19Time limit exceeded0/2250ms4896 KiB
20Time limit exceeded0/2246ms4472 KiB
21Time limit exceeded0/2254ms5092 KiB
22Time limit exceeded0/2238ms4996 KiB