26712023-01-18 17:32:40KristófVölgy (100 pont)cpp11Time limit exceeded 5/100300ms3572 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){
        se++;
        sec++;
    }
    if(m[seco]>s){
        seco++;
        s=m[seco+1];
    }
    else{
        se++;
        seco++;
        s=m[seco+1];
    }
}
while(sec<1){
    if(m[i]==s){

        sec++;
    }
    if(m[seco]<s){
        seco++;
        s=m[seco+1];
    }
    else{
            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
base5/100
1Time limit exceeded0/0256ms1144 KiB
2Time limit exceeded0/0272ms2052 KiB
3Time limit exceeded0/5268ms2412 KiB
4Time limit exceeded0/5256ms2472 KiB
5Time limit exceeded0/5257ms2724 KiB
6Time limit exceeded0/5266ms2856 KiB
7Accepted5/52ms3088 KiB
8Time limit exceeded0/5300ms3088 KiB
9Time limit exceeded0/5248ms3108 KiB
10Time limit exceeded0/5280ms2336 KiB
11Time limit exceeded0/5256ms3228 KiB
12Time limit exceeded0/5240ms2684 KiB
13Time limit exceeded0/5277ms3516 KiB
14Time limit exceeded0/5273ms3572 KiB
15Time limit exceeded0/5277ms3096 KiB
16Time limit exceeded0/5248ms3160 KiB
17Time limit exceeded0/5256ms3156 KiB
18Time limit exceeded0/5277ms3240 KiB
19Time limit exceeded0/5238ms3164 KiB
20Time limit exceeded0/5270ms3360 KiB
21Time limit exceeded0/5266ms3372 KiB
22Time limit exceeded0/5241ms3500 KiB