L2-021 点赞狂魔 (25分)
程序员文章站
2022-06-07 23:35:03
...
#include <bits/stdc++.h>
using namespace std;
int n;
set<int> s;
struct node {
string name;
int cnt,avg;
bool operator <(const node &a){
if(cnt != a.cnt)
return cnt > a.cnt;
return avg < a.avg;
}
} e[110];
int main() {
ios::sync_with_stdio(0);
cin >> n;
for(int i = 0; i < n; i++) {
cin >> e[i].name;
int k,x;
cin >> k;
s.clear();
e[i].avg = k;
while(k--) {
cin >> x;
s.insert(x);
}
e[i].cnt = s.size();
}
sort(e,e+n);
if(n == 1) cout << e[0].name << " - -" << endl;
else {
if(n == 2) {
cout << e[0].name << " " << e[1].name << " " << "-" << endl;
} else {
cout << e[0].name << " " << e[1].name << " " << e[2].name << endl;
}
}
return 0;
}