This code is giving time limit exceeded SIGTSTP error, whats wrong in this code

#include<bits/stdc++.h>

using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;

    long long a[n];
    long long g=0,k=0;
    
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>=0)
        {
            g+=1;
        }
        else
        {
            k+=1;
        }
    }
    if(k==0)
    {
        cout<<n<<" "<<n<<endl;
    }
    
    else
    {
        if(g>k)
        {
            cout<<g<<" "<<k<<endl;
        }
        else
        {
            cout<<k<<" "<<g<<endl;
        }
    
	}
    
}

}