27242023-01-19 13:42:34Tibi23Völgy (100 pont)cpp11Wrong answer 75/100268ms4956 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int magassag[n];
    for(int i=0; i<n; i++)
        cin>>magassag[i];

    int k, v;

    int maxhossz=-2;
    int masodik = 0; //második legnagyobb indexe

    for(k=0; k<=n-3; k++){
        v=k+1;
        masodik=k+1;
        while(magassag[v]<magassag[k] && v!=n){
            if (magassag[v]>magassag[masodik])
                masodik=v;
            v++;

        }
        if(v==n){
            v=masodik;
        }

        if(v-k>maxhossz)
            maxhossz=v-k;

        k=v-1;
    }

    cout<<maxhossz;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/100
1Accepted0/03ms1880 KiB
2Accepted0/03ms2116 KiB
3Accepted5/52ms2360 KiB
4Accepted5/52ms2388 KiB
5Accepted5/52ms2352 KiB
6Accepted5/52ms2480 KiB
7Wrong answer0/52ms2732 KiB
8Accepted5/52ms2808 KiB
9Wrong answer0/54ms3096 KiB
10Accepted5/53ms3160 KiB
11Accepted5/54ms3208 KiB
12Accepted5/54ms3324 KiB
13Accepted5/54ms3440 KiB
14Accepted5/56ms3648 KiB
15Accepted5/530ms4456 KiB
16Accepted5/535ms4556 KiB
17Time limit exceeded0/5259ms3516 KiB
18Accepted5/535ms4812 KiB
19Time limit exceeded0/5268ms3616 KiB
20Accepted5/537ms4808 KiB
21Time limit exceeded0/5256ms3612 KiB
22Accepted5/537ms4956 KiB