235162026-01-24 10:22:13BoldizsárVölgy (100 pont)cpp17Wrong answer 15/10035ms800 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;cin >> n;
    int ans =0;
    vector<int>volgy(n);
    for(int i = 0;i < n;i++){cin >> volgy[i];}
    int l1=0,l2=1;
    for(int i =0;i < n;i++){
        if (volgy[i] > volgy[l1]){
            l1 = i;l2 = -1;
        }else if(volgy[i] == volgy[l1]){
            l1=i;l2 = -1;
        }else if(volgy[i]> volgy[l2] || l2 == -1){
            l2 = i;
        }
        if(l2 != -1) ans = max(ans,abs(l1-l2));
    }
    cout << ans;
}
SubtaskSumTestVerdictTimeMemory
base15/100
1Wrong answer0/01ms316 KiB
2Accepted0/01ms316 KiB
3Wrong answer0/51ms316 KiB
4Wrong answer0/51ms316 KiB
5Accepted5/51ms316 KiB
6Accepted5/51ms508 KiB
7Wrong answer0/51ms316 KiB
8Wrong answer0/51ms332 KiB
9Wrong answer0/51ms332 KiB
10Accepted5/51ms316 KiB
11Wrong answer0/52ms416 KiB
12Wrong answer0/53ms500 KiB
13Wrong answer0/54ms500 KiB
14Wrong answer0/54ms316 KiB
15Wrong answer0/528ms564 KiB
16Wrong answer0/532ms796 KiB
17Wrong answer0/532ms564 KiB
18Wrong answer0/532ms800 KiB
19Wrong answer0/532ms564 KiB
20Wrong answer0/535ms564 KiB
21Wrong answer0/535ms564 KiB
22Wrong answer0/535ms564 KiB