#include<cstdio>
#include<iostream>
#include<cstring>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
map<string,int>mp;
int main()
{
int t;
cin>>t;
while(t--)
{
mp.clear();
int n,q;
cin>>n>>q;
int m;
cin>>m;
for(int i=0;i<m;i++)
{
string name;
cin>>name;
mp[name]=0;
}
for(int i=0;i<q;i++)
{
int a;
cin>>a;
while(a--)
{
string str;
cin>>str;
mp[str]+=pow(2,i);
}
}
while(n--)
{
int ans=0;
string ss;
int flag=0;
for(int i=0;i<q;i++)
{
int k;
scanf("%d",&k);
if(k==1)
ans+=pow(2,i);
}
for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++)
{
if(it->second==ans)
{
flag++;
ss=it->first;
}
}
if(flag!=1)
cout<<"Let's go to the library!!"<<endl;
else
cout<<ss<<endl;
}
}
return 0;
}
看题看了很久
然后看懂了又不知道如何比较
如果一个个比较的话
肯定会很麻烦
发生很多小错误
所以可以定义一个map容器
一个姓名对应他对的题目的分数
然后遍历