27212023-01-19 13:39:12DalmVölgy (100 pont)cpp11Wrong answer 75/100246ms5652 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/02ms2080 KiB
3Accepted5/52ms2292 KiB
4Accepted5/52ms2396 KiB
5Accepted5/52ms2588 KiB
6Accepted5/52ms2796 KiB
7Wrong answer0/52ms3000 KiB
8Accepted5/52ms3204 KiB
9Wrong answer0/54ms3448 KiB
10Accepted5/53ms3652 KiB
11Accepted5/54ms3760 KiB
12Accepted5/54ms3720 KiB
13Accepted5/54ms3728 KiB
14Accepted5/56ms3860 KiB
15Accepted5/530ms4672 KiB
16Accepted5/535ms4924 KiB
17Time limit exceeded0/5246ms3992 KiB
18Accepted5/535ms5416 KiB
19Time limit exceeded0/5243ms4356 KiB
20Accepted5/537ms5652 KiB
21Time limit exceeded0/5246ms4432 KiB
22Accepted5/537ms5612 KiB