70502023-12-28 22:23:43IgnácVölgy (100 pont)cpp17Accepted 100/10041ms4392 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> b(n);
	int kezdi = -1, kezdh = 0, maximum = 1;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		b[n - 1 - i] = a;
		if (a >= kezdh) {
			maximum = max(maximum, i - kezdi);
			kezdi = i;
			kezdh = a;
		}
	}

	kezdi = -1;
	kezdh = 0;
	for (int i = 0; i < n; i++) {
		int a = b[i];
		if (a >= kezdh) {
			maximum = max(maximum, i - kezdi);
			kezdi = i;
			kezdh = a;
		}
	}

	if (maximum == 1) cout << -1;
	else cout << maximum;
}
SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/03ms1852 KiB
2Accepted0/03ms2008 KiB
3Accepted5/53ms2088 KiB
4Accepted5/53ms2216 KiB
5Accepted5/53ms2428 KiB
6Accepted5/53ms2512 KiB
7Accepted5/53ms2508 KiB
8Accepted5/53ms2672 KiB
9Accepted5/53ms2804 KiB
10Accepted5/53ms2948 KiB
11Accepted5/54ms3016 KiB
12Accepted5/54ms3020 KiB
13Accepted5/56ms3012 KiB
14Accepted5/56ms3016 KiB
15Accepted5/532ms3952 KiB
16Accepted5/537ms3988 KiB
17Accepted5/537ms4052 KiB
18Accepted5/537ms3960 KiB
19Accepted5/537ms4156 KiB
20Accepted5/541ms4244 KiB
21Accepted5/541ms4244 KiB
22Accepted5/541ms4392 KiB