Max biotonic subarray

the code is working in hackerblocks but not when submitted in course dashboard

#include
using namespace std;
int main() {

int t;
cin>>t;
for(int j=0;j<t;j++){
	int n;
	cin>>n;
	int a[n],inc[n],dec[n];

	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for (int i = 0; i < n ; i++){ 
    	dec[i] = 1; 
	} 

	for (int i = 0; i < n ; i++){ 
    	inc[i] = 1; 
	}   

	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){

			if(a[i]>a[j] && inc[i]<inc[j]+1){
				inc[i]=inc[j]+1;
			} 

		}
	}

	for(int i=n-2;i>=0;i--){
		for(int j=n-1;j>i;j--){
			if(a[i]>a[j] && dec[i]<dec[j]+1){
				dec[i]=dec[j]+1;
			} 
		}
	}

	int max;
	max=(inc[0]+dec[0]-1);
	for(int i=1;i<n;i++){
		if(max<(inc[i]+dec[i]-1)){
			max=inc[i]+dec[i]-1;
		}
	}

	cout<<max<<endl;		

}

return 0;

}

please solve it as soon as possible

hi
save ur code to online ide of coding block and then post the link here

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.