TLE ERROR in a Test Case of Maximum Length Bitonic Subarray Problem

I am getting TLE error in one of the test cases. of Max Length Bitonic Subarray. I have watched the editorial provided by CB and my solution is almost same. Kindly check

Here is my code-:

#include<bits/stdc++.h>
using namespace std;

int bitonic(int a[], int n)
{
int inc[n],dec[n], largest = 0;
int count=1, count2=1;
inc[0] = 1;
dec[n-1] = 1;
for(int i=1; i<n; i++)
{
if(a[i]>=a[i-1])
{
count++;
inc[i] = count;
}
else
{
count = 1;
inc[i] = count;
}
}
for(int i=n-2; i>=0; i–)
{
if(a[i]>=a[i+1])
{
count2++;
dec[i] = count2;
}
else
{
count2 = 1;
dec[i] = count2;
}
}
for(int i=0; i<n; i++)
largest = max(largest, (inc[i] + dec[i] - 1));

return largest;

}

int main()
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
int a[n];
for (int i = 0; i< n ; i++)
{
cin>>a[i];
}
cout<<bitonic(a, n)<<endl;
}
}


refer to this code

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.