63382023-11-20 11:13:53GervidFasor (40)cpp17Wrong answer 34/4072ms16384 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 << -1;
}
//10 3
//6 2 1 8 4 8 7 12 9 3
SubtaskSumTestVerdictTimeMemory
base34/40
1Accepted0/03ms1812 KiB
2Accepted0/04ms2224 KiB
3Accepted2/23ms2164 KiB
4Wrong answer0/23ms2388 KiB
5Accepted2/23ms2592 KiB
6Accepted2/23ms2832 KiB
7Accepted2/23ms3048 KiB
8Accepted2/23ms3412 KiB
9Accepted2/26ms3712 KiB
10Accepted2/26ms3872 KiB
11Accepted2/26ms4060 KiB
12Accepted2/24ms4252 KiB
13Accepted2/237ms5552 KiB
14Wrong answer0/235ms6420 KiB
15Accepted2/257ms7960 KiB
16Accepted2/267ms9428 KiB
17Accepted2/272ms10948 KiB
18Accepted2/272ms12420 KiB
19Accepted2/272ms13676 KiB
20Wrong answer0/221ms13512 KiB
21Accepted2/257ms15020 KiB
22Accepted2/271ms16384 KiB