#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1010;
int main(){
int n, m;
cin >> n >> m;//n 和 m分别表示文章篇数和单词编号上限
int p[N] = {0}; //每个单词出现的总文章数
int g[N] = {0}; //每个单词出现总次数
for (int i = 1; i <= n; i++){//文章循环
int st[N] = {0};//状态,如果加过了就置为1
int cnt;
cin >> cnt; //文章单词个数
for (int j = 1; j <= cnt; j++){//文章中单词循环
int x;
cin >> x;
g[x] ++;
if(st[x] == 0){
p[x] ++;
st[x] = 1;
}
}
}
for (int i = 1; i <= m; i++){
cout << p[i] << " " << g[i] << endl;
}
}
CSP 词频分析
最新推荐文章于 2024-10-31 20:10:41 发布