Can you look my code of codechef sept long challenge of question "Coronavirus Spread 2" where the apporach is right?

//look this code if apporach is not right then suggest me how to apporach this question

//Coronavirus Spread 2

#include
using namespace std;

bool ismax(int a[],int n){
for(int i=1;i<n;i++){
if(a[0]<a[i]){
return false;
}
}
return true;
}

int main() {
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[n];
int d;
for(int i=0;i<n;i++){
cin>>d;
a[i] = d*10;
}
int worst = 1, best =1;
int maxans = 0;
int minans = 999;
for(int j=0;j<n-1;j++){
best=1;
worst =1;
for(int i=j;i<n-1;i++){
if(a[j]>a[i+1]){
best++;
worst++;
}
}
minans = min(minans,worst);
maxans = max(maxans,best);
}

    worst = minans;
    best = maxans;

    if(ismax(a,n) && a[0]>=a[1]){
        worst = best;
    }              
    cout<<worst<<" "<<best<<'\n';
}
return 0;

}

@krishav49 hey send me the question .

Question

@krishav49 hey this is live contest and we are not allowed to tell the approach of live contests, sorry for that and you are too close trying solving it. All the best.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.