Mximum length biotonic subarray

I did this my way. Im getting correct answer to the sample input . But when i submit it , it doesn’t show the right answer. There is another way of doing this by which im getting the right answer . but can you pls tell me whats wrong in my code;
#include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int n,a[10000],i;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
int p=0;
for(i=0;i<n-2;i++)
{
if(a[i]>=a[i+1])
{
if(a[i+1]<=a[i+2])
{ p=i+1;

			}
		}
		

	}
	int count=0;
	for(int j=p;j<n;j++)
	{	count++;
	}
	cout<<count<<endl;

}

return 0;

}

The best way is to divide the problem into subproblems. Take this pseudo code as reference/hint and try to solve.

        if(input[i]>input[j]&&inc[i]<(inc[j]+1))
            inc[i]=inc[j]+1;

Whenever at a particular position, if that element has value lesser than the previous largest number and if length at that position is lesser than previous position, add 1 into the length.

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.