牛客暑期多校训练营8
发表于:2023-08-14 | 分类: 思维
字数统计: 132 | 阅读时长: 1分钟 | 阅读量:

更新至A…

题A

题意:nn 组camp,每组若干个人,问多少人参加了全部camp
解:略

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<bits/stdc++.h>
using namespace std;
map<string,int> p, q;
int main(){
int n; cin >> n;
set<string> s;
for(int j = 1; j <= n; ++ j){
int c; cin >> c;
for(int i = 1; i <= c; ++ i) {
string x; cin >> x;
p[x] ++;
s.insert(x);
}
}
for(auto [x, y]: p) if(y == n) q[x] ++;

cout << q.size() << '\n';
for(auto [x, y]: q) cout << x << '\n';

}
上一篇:
牛客暑期多校训练营10
下一篇:
牛客暑期多校训练营6