简单的set,struct,map使用。
`
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int n,m;
struct a{
int flag;
set [HTML_REMOVED] s;
map[HTML_REMOVED] mp;
}a[110];
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i].flag;
for(int j=1;j<=a[i].flag;j++){
int shu;
cin>>shu;
a[i].mp[shu]++;//键值对
a[i].s.insert(shu);
}
}
int find_shu[110]={0};
int all_shu[110]={0};
for(int i=1;i<=n;i++){//篇
for(int j=1;j<=m;j++){//找单词1,2,3
if(a[i].s.find(j)!=a[i].s.end()) find_shu[j]++;
all_shu[j]+=a[i].mp[j];
}
}
for(int i=1;i<=m;i++){
cout<<find_shu[i]<<" "<<all_shu[i]<<endl;
}
}`