Still Wrong Answer

As u have suggested me I have likewise:

code:

using namespace std;
#include
int main()
{
int t;
cin>>t;
while(t–)
{
int n,index=0,count_Inc=0,count_Dec=0,max=0;
cin>>n;
int a[n];
int inc[n]={1},dec[n]={1}; //two subarrays which contain longest subsequences correspond to their
names;
for(int i=0;i<n;i++)
cin>>a[i];

	for(int i=0;i<n-1;i++)
	{
		
		if(a[i]<a[i+1])
		{
			if(count_Dec!=0)
			{
				dec[index]=++count_Dec;
				count_Dec=0;
			}
			count_Inc++;
		}
		
		else
		{
			if(count_Inc!=0)
			{
				index=i;
				inc[index]=++count_Inc;
				count_Inc=0;
			}
			count_Dec++;
		}
	}
	//Last values remain to placed becoz loop ends at n-2
	if(count_Dec!=0)
	dec[index]=++count_Dec;		

	else if(count_Inc!=0)
	inc[index]=++count_Inc;
	
	//evaluate max
	for(int i=0;i<n;i++)
	{
		if((inc[i]+dec[i]-1)>max)
		max=(inc[i]+dec[i]-1);
	}
	cout<<max<<endl;
}

}

@n.nishchaya2000
Please send your code on CB IDE

@n.nishchaya2000
Line 12
inc[0] = 1
you did inc[n] = 1

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.