如题(一直52分,有两个点re)
#include<bits/stdc++.h>
using namespace std;
unsigned long long n[100010],m[100010],a[100010],b[100010];
bool judge;
int main()
{
unsigned long long t,N,M,top1=0,top2=0;
cin>>t;
for (int i=1;i<=t;i++)
{
cin>>N>>M;
for (int i=1;i<=N;i++)
{
a[i]=1;
cin>>n[i];
top1++;
a[i]*=n[i];
}
for (int i=1;i<=M;i++)
{
b[i]=1;
cin>>m[i];
top2++;
b[i]*=m[i];
}
}
for (int i=1;i<=t;i++)
{
if (a[i]/b[i]==2) cout<<"YES"<<endl;
for (int i=1;i<=sqrt(a[i]/b[i]);i++)
{
if ((a[i]/b[i])%i!=0)
judge=true;
if ((a[i]/b[i])%i==0)
{
judge=false;
continue;
}
}
if (judge==true)
cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}