Please Help I can’t figure out why time limit is excedding?

#include

#include

using namespace std;

int main(){

```
int T,n;
string ans;
cin>>T;
for(int i=1;i<=T;i++){
cin>>n;
int ar[n];
for(int j=0;j<n;j++){
cin>>ar[j];
}
int temp=0;
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
int temp1=0;
if(j==k);
else{
for(int l=0;l<n;l++){
if((ar[j]*ar[k])==ar[l])temp1++;
}
}
if(temp1>0)temp++;
}
}
if(temp==((n*n)-n)){
ans = ans+"yes\n";
}
else ans=ans+"no\n";
}
cout<<ans<<endl;
return 0;
```

}