关注
#include "iostream"
#include "vector"
#include "algorithm"
#include "unordered_set"
#include "set"
#include "unordered_map"
#include "cstdio"
#include "queue"
#include "algorithm"
#include "climits"
#include "map"
#include "stack"
#include "cstring"
#include "climits"
using namespace std;
#define ll long long
#define mod 1000000007
struct score{
int s;
int v;
int l;
string name;
score(string s):name(s),s(0),v(0),l(0){}
};
void getName(string s,string& a,string& b){
int i=0;
while(s[i]!='-')i++;
a=s.substr(0,i);
b=s.substr(i+1,s.length()-i-1);
}
void getS(string s,int& a,int& b){
int i=0;
while(s[i]!=':')i++;
a=0;b=0;
for(int j=0;j<i;j++)a=10*a+s[j]-'0';
for(int j=i+1;j<s.length();j++)b=10*b+s[j]-'0';
}
bool cmp(score* a,score* b){
if(a->s>b->s)return true;
if(a->s<b->s)return false;
if((a->v-a->l)>(b->v-b->l))return true;
if((a->v-a->l)<(b->v-b->l))return false;
return (a->v)>(b->v);
}
int main(){
int n;
while(cin>>n){
unordered_map<string,int> map;
vector<score*> a(n);
int i;
string name;
for(i=0;i<n;i++){
cin>>name;
a[i]=new score(name);
map[name]=i;
}
int L=n*(n-1)/2;
string p,q;
string name1,name2;
int s1,s2;
for(i=0;i<L;i++){
cin>>p>>q;
getName(p,name1,name2);
getS(q,s1,s2);
//cout<<name1<<" "<<name2<<endl;
int id1=map[name1];
int id2=map[name2];
a[id1]->v+=s1;
a[id2]->v+=s2;
a[id1]->l+=s2;
a[id2]->l+=s1;
if(s1>s2){
a[id1]->s+=3;
}else if(s1==s2){
a[id1]->s+=1;
a[id2]->s+=1;
}else{
a[id2]->s+=3;
}
}
sort(a.begin(),a.end(),cmp);
for(int i=0;i<n;i++){
//cout<<a[i]->name<<" "<<a[i]->s<<" "<<a[i]->v<<" "<<a[i]->l<<endl;
}
n/=2;
vector<string> result(n);
for(int i=0;i<n;i++){
result[i]=a[i]->name;
}
sort(result.begin(),result.end());
for(int i=0;i<n;i++){
cout<<result[i]<<endl;
}
}
return 0;
}
40%...
查看原帖
点赞 评论
相关推荐
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客热帖
更多
正在热议
更多
# 大疆求职进展汇总 #
472142次浏览 3180人参与
# 摸鱼被leader发现了怎么办 #
44557次浏览 318人参与
# 找工作,行业重要还是岗位重要? #
18585次浏览 316人参与
# 潍柴工作体验 #
20501次浏览 17人参与
# 你觉得通信/硬件有必要实习吗? #
95333次浏览 893人参与
# 来聊聊机械薪资天花板是哪家 #
113065次浏览 721人参与
# 你最满意的offer薪资是哪家公司? #
18732次浏览 119人参与
# 硬件兄弟们 甩出你的华为奖状 #
96096次浏览 670人参与
# 金融财会交流会 #
101740次浏览 361人参与
# 机械人与华为的爱恨情仇 #
106246次浏览 923人参与
# 24届硬件人与华为的爱恨情仇 #
120854次浏览 962人参与
# 运营面经 #
101968次浏览 1202人参与
# 机械人怎么评价今年的华为 #
191282次浏览 1502人参与
# 外包能不能当跳板? #
26004次浏览 192人参与
# Offer比较,求稳定还是求发展 #
42334次浏览 228人参与
# 学历or实习经历,哪个更重要 #
88358次浏览 647人参与
# 国企还是互联网,你怎么选? #
127281次浏览 963人参与
# 国企/银行/研究所公司爆料 #
124641次浏览 742人参与
# 设计人如何选offer #
101956次浏览 697人参与
# 机械专业只有考研才有出路吗 #
96111次浏览 850人参与