63392023-11-20 11:17:57GervidFasor (40)cpp17Accepted 40/4072ms5456 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, k, i, j;
	cin >> n >> k;

	vector<unsigned int> trees(n);

	for (i = 0; i < n; i++)
	{
		cin >> trees[i];
	}

	int max = trees[0], maxi = 0;

	for (i = 1; i < n; i++)
	{
		if (i - maxi > k)
		{
			cout << maxi + 1;
			return 0;
		}

		if (trees[i] > max)
		{
			max = trees[i];
			maxi = i;
			continue;
		}
	}
	cout << maxi + 1;
}
//10 1
//1 2 1 8 4 8 7 12 9 3
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1808 KiB
2Accepted0/04ms2228 KiB
3Accepted2/22ms2088 KiB
4Accepted2/23ms2332 KiB
5Accepted2/23ms2580 KiB
6Accepted2/23ms2840 KiB
7Accepted2/23ms3028 KiB
8Accepted2/23ms3212 KiB
9Accepted2/24ms3492 KiB
10Accepted2/26ms3708 KiB
11Accepted2/26ms3836 KiB
12Accepted2/24ms3572 KiB
13Accepted2/237ms4584 KiB
14Accepted2/234ms4324 KiB
15Accepted2/256ms4976 KiB
16Accepted2/265ms5252 KiB
17Accepted2/272ms5324 KiB
18Accepted2/271ms5456 KiB
19Accepted2/271ms5356 KiB
20Accepted2/221ms4788 KiB
21Accepted2/257ms5436 KiB
22Accepted2/272ms5436 KiB