#include <bits/stdc++.h>
using namespace std;
int a[200005],b[200005],c[200005][2];
int main ()
{
ios::sync_with_stdio(false);
int T;
cin>>T;
while(T--)
{
int n;
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int i=0; i<n; i++)
cin>>b[i];
for(int i=0; i<n; i++)
c[i][0]=c[i][1]=0;
for(int i=1; i<n; i++)
{
c[i][0]=c[i-1][0];
c[i][1]=c[i-1][1];
if(a[i-1]==1) c[i][0]=1;
if(a[i-1]==-1) c[i][1]=1;
}
int f=0;
for(int i=0; i<n&&f==0; i++)
{
if(a[i]==b[i]) continue;
if(a[i]>b[i])
{
if(c[i][1]) continue;
f=1;
}
if(a[i]<b[i])
{
if(c[i][0]) continue;
f=1;
}
}
if(f==0) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
哈哈
#include <bits/stdc++.h>
using namespace std;
int main ()
{
ios::sync_with_stdio(false);
int T;
cin>>T;
while(T--)
{
int n,m;
cin>>n>>m;
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(i==0&&j!=0) cout<<"W";
else cout<<"B";
}
cout<<endl;
}
}
return 0;
}