30362023-02-08 19:29:18xxxVölgy (100 pont)cpp11Wrong answer 95/10037ms4856 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    int volgymax = 0, cnt = 0, cntmax = 0;
    for (int i =0; i < n; i++) {
        cin >> a[i];
        if (a[i] >= volgymax) {
            volgymax = a[i];
            if (cnt > cntmax) cntmax = cnt;
            cnt = 1;
        } else {
            cnt++;
        }
    }
    int temp = 0, tempk = 0;
    if (cnt > cntmax)
        for (int i = n-cnt+1; i < n; i++){
            if (a[i] > temp) {
                temp = a[i];
                tempk = i;
            }
        }

    tempk = tempk - (n - cnt);
    if (tempk > cntmax)
        cntmax = tempk;
    if (cntmax < 2) cout << -1;
    else cout << cntmax;
	return 0;
}

SubtaskSumTestVerdictTimeMemory
base95/100
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted5/53ms2364 KiB
4Accepted5/53ms2544 KiB
5Accepted5/53ms2740 KiB
6Accepted5/53ms2972 KiB
7Accepted5/53ms3028 KiB
8Accepted5/53ms3028 KiB
9Accepted5/53ms3004 KiB
10Accepted5/53ms3128 KiB
11Accepted5/54ms3228 KiB
12Accepted5/54ms3472 KiB
13Accepted5/54ms3460 KiB
14Wrong answer0/56ms3464 KiB
15Accepted5/530ms4416 KiB
16Accepted5/535ms4412 KiB
17Accepted5/534ms4420 KiB
18Accepted5/535ms4412 KiB
19Accepted5/535ms4528 KiB
20Accepted5/537ms4540 KiB
21Accepted5/537ms4752 KiB
22Accepted5/537ms4856 KiB