您的位置:首页 > 其它

L2-021. 点赞狂魔 set

2018-03-11 22:05 351 查看
https://www.patest.cn/contests/gplt/L2-021

#include <bits/stdc++.h>
#include <set>
#include <map>
using namespace std;

const int maxn=105;

set <int> s;
struct Node{
string name;
int sum;
int k;
bool operator <(Node obj) const{
if (sum==obj.sum){
return k<obj.k;
}
return sum>obj.sum;
}
}node[maxn];

int n;

int main(){

cin >> n;
for (int i=0;i<n;i++){
cin >> node[i].name;
cin >> node[i].k;
s.clear();
for (int j=0;j<node[i].k;j++){
int x;
cin >> x;
s.insert(x);
}
node[i].sum=s.size();
}

sort(node,node+n);

if (n>=3){
cout << node[0].name << " " << node[1].name << " " <<node[2].name;
}
if (n==2){
cout << node[0].name << " " << node[1].name << " -" << endl;
}
if (n==1){
cout << node[0].name << " - -" << endl;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: