26722023-01-18 19:06:42KristófVölgy (100 pont)cpp11Wrong answer 15/10037ms4412 KiB
#include <iostream>

using namespace std;

int main()
{
int n;
cin>>n;
int k;
int v;
int ut=-1;
int s;
int m[n];
int o=0;
for(int i=0;i<n;i++){
    cin>>m[i];
}

for(int i=0;i<n;i++){
        s=m[i++];
        int se=0;
        int sec=0;
        int seco=i;
while(se<1){
    if(m[i]==s || m[i]<s || i==n){
        se++;
        sec++;
    }
    if(m[seco]>s){
        seco++;
        s=m[seco+1];
    }
    else{
            if(seco+1==n){
                break;
            }
        se++;
        seco++;
        s=m[seco+1];
    }
}
while(sec<1){
    if(m[i]==s){

        sec++;
    }
    if(m[seco]<s){
        seco++;
        s=m[seco+1];
    }
    else{
            sec=1;
            int l=i;
    int p=i+1;
    while(l<=seco && o<1){
        if(m[seco]>m[p]){
            l++;
            p++;
        }
        else{
            o++;
        }
        if(l==seco){
            k=i;
            v=seco;
            if(ut<v-k)
                ut=v-k;
        }
    }

}
}
}
cout<<ut;


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/100
1Wrong answer0/03ms1748 KiB
2Wrong answer0/02ms1912 KiB
3Wrong answer0/52ms1988 KiB
4Wrong answer0/52ms2128 KiB
5Wrong answer0/52ms2376 KiB
6Wrong answer0/52ms2576 KiB
7Accepted5/52ms2656 KiB
8Wrong answer0/52ms2676 KiB
9Accepted5/52ms2608 KiB
10Wrong answer0/52ms2744 KiB
11Wrong answer0/54ms3000 KiB
12Wrong answer0/54ms3164 KiB
13Wrong answer0/54ms3236 KiB
14Wrong answer0/56ms3368 KiB
15Wrong answer0/530ms4180 KiB
16Wrong answer0/535ms4176 KiB
17Accepted5/534ms4296 KiB
18Wrong answer0/534ms4304 KiB
19Wrong answer0/535ms4412 KiB
20Wrong answer0/537ms4412 KiB
21Wrong answer0/537ms4380 KiB
22Wrong answer0/537ms4400 KiB