我太菜了,请各位大佬见谅
提交记录
#include<bits/stdc++.h>
using namespace std;
int T,a[5][100],tmp,vis[5],tmp2;
char ch;
string s;
signed main(){
cin>>T;
for(int i=1;i<=4;i++){
for(int j=1;j<=6;j++){
cin>>ch;
a[i][int(ch)]=1;
}
}
while(T--){
cin>>s;
tmp2=1;
for(int i=0;i<s.size();i++){
tmp=0;
for(int j=1;j<=4;j++){
if(vis[j])continue;
ch=s[i];
if(a[j][int(ch)]==1){
tmp=1;
vis[j]=1;
break;
}
}
if(tmp==0){
tmp2=0;
break;
}
}
for(int i=1;i<=4;i++){
vis[i]=0;
}
if(tmp2)printf("YES\n");
else printf("NO\n");
}
return 0;
}
QAQ