Help me in solving SUBARRY problem

My issue

how to do this

My code

#include <iostream>
using namespace std;

int main() {
	int t,a,n;
	cin>>t;
	while(t--){
	    int arr[n]
	    for(int i=0; i<n; i++){
	        cin>>arr[i];
	        
	}
	
}

Problem Link: Interesting Subarray Practice Coding Problem - CodeChef

@rsxthz
here ,plzz refer my c++ code

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n;
	    cin>>n;
	    long long int a[n];
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	    }
	    sort(a,a+n);
	    long long int a1=a[0]*a[n-1];
	    //long long int a4=a[n-1]*a[n-2];
	    long long int a2=a[n-1]*a[n-1];
	    long long int a3=a[0]*a[0];
	    cout<<min(a1,a2)<<" "<<max(a2,a3)<<endl;
	}
	return 0;
}