37492023-03-02 18:35:42grengFasor (40)cpp11Time limit exceeded 22/40300ms6224 KiB
#include <iostream>


using namespace std;

int fak[200001];
int K;
int N;


void in() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> fak[i];
	}
}

int szamit() {
	for (int i = 0; i < N; i++) {
		bool bad = false;

		for (int j = (i - K >= 0) * (i - K); j < i; j++) {
			if (fak[j] > fak[i]) {
				bad = true;
				break;
			}
		}
		if (bad)
			continue;
		for (int l = i + 1; l <= i + K; l++) {
			if (fak[l] > fak[i]) {
				bad = true;
				break;
			}
		}
		if (!bad)
			return i+1;
	}
}

int main() {
	in();
	cout << szamit();
}
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/03ms1884 KiB
2Accepted0/04ms2284 KiB
3Accepted2/23ms2328 KiB
4Accepted2/22ms2428 KiB
5Accepted2/23ms2920 KiB
6Accepted2/23ms2856 KiB
7Accepted2/23ms3080 KiB
8Accepted2/23ms3084 KiB
9Accepted2/24ms3480 KiB
10Accepted2/26ms3380 KiB
11Accepted2/26ms3708 KiB
12Accepted2/24ms3812 KiB
13Time limit exceeded0/2300ms3228 KiB
14Time limit exceeded0/2246ms3356 KiB
15Time limit exceeded0/2270ms4020 KiB
16Time limit exceeded0/2282ms4184 KiB
17Time limit exceeded0/2246ms4236 KiB
18Time limit exceeded0/2270ms4224 KiB
19Time limit exceeded0/2273ms4356 KiB
20Time limit exceeded0/2266ms4004 KiB
21Time limit exceeded0/2277ms4356 KiB
22Accepted2/271ms6224 KiB