130672025-01-05 14:40:38szabelrFasor (40)cpp17Time limit exceeded 20/40300ms1184 KiB
#include <iostream>
using namespace std;
int fak[200001]{ 0 };
int main()
{
    long long n, k, h,max=0;
    cin >> n>>k;
    for (int i = 1; i <= n; i++) {
        cin >> h;
        fak[i] = h;
        if (h > max)
            max = h;
    }
    for (int i = 1; i <= n; i++) {
        int ln = 0;
        for (int y = i; y <= i + k and y<=max; y++) {
            if (fak[y] > fak[i])
                ln = 1;
        }
        if (ln == 0) {
            for (int y = i; y > i - k and y > 0; y--) {
                if (fak[y] > fak[i])
                    ln = 1;
            }
        }
        if (ln == 0) {
            cout << i;
            break;
        }
    }

}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/01ms320 KiB
2Accepted0/04ms512 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms508 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/22ms320 KiB
9Accepted2/24ms508 KiB
10Accepted2/24ms320 KiB
11Accepted2/24ms424 KiB
12Accepted2/23ms420 KiB
13Time limit exceeded0/2298ms704 KiB
14Time limit exceeded0/2300ms672 KiB
15Wrong answer0/259ms1184 KiB
16Time limit exceeded0/2300ms1160 KiB
17Time limit exceeded0/2289ms1184 KiB
18Time limit exceeded0/2286ms1080 KiB
19Time limit exceeded0/2287ms1080 KiB
20Wrong answer0/220ms568 KiB
21Wrong answer0/257ms944 KiB
22Time limit exceeded0/2280ms1080 KiB