27222023-01-19 13:39:57Tibi23Völgy (100 pont)cpp11Wrong answer 75/100300ms4976 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=-1;
    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/03ms1876 KiB
2Accepted0/02ms2124 KiB
3Accepted5/52ms2312 KiB
4Accepted5/52ms2348 KiB
5Accepted5/52ms2600 KiB
6Accepted5/52ms2848 KiB
7Wrong answer0/52ms2800 KiB
8Accepted5/52ms2820 KiB
9Wrong answer0/54ms3132 KiB
10Accepted5/52ms3136 KiB
11Accepted5/54ms3212 KiB
12Accepted5/54ms3308 KiB
13Accepted5/54ms3436 KiB
14Accepted5/56ms3636 KiB
15Accepted5/530ms4376 KiB
16Accepted5/535ms4656 KiB
17Time limit exceeded0/5300ms3516 KiB
18Accepted5/535ms4712 KiB
19Time limit exceeded0/5300ms3536 KiB
20Accepted5/537ms4960 KiB
21Time limit exceeded0/5239ms3728 KiB
22Accepted5/537ms4976 KiB