题解 P5594 【【XR-4】模拟赛】

StudyingFather

2019-10-20 23:13:02

Solution

用 `std::set`,可以方便地起到统计一天要准备多少模拟赛的作用。 我们只需将每个人当天要准备的模拟赛编号,插入当天的 `set` 当中,后面查询每天对应的 `set` 有多少元素即可。 ```cpp #include <cstdio> #include <vector> #include <set> using namespace std; vector<set<int> > v; set<int> s; int main() { int n,m,k; scanf("%d%d%d",&n,&m,&k); for(int i=0;i<=k;i++) v.push_back(s); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { int x; scanf("%d",&x); v[x].insert(j); } for(int i=1;i<=k;i++) printf("%d ",v[i].size()); return 0; } ```