炒鸡\(6\)批的模拟题。

注意的是输入

把握好空格 大小写。

根据题目的这句话来排序

积分榜是按照以下原则制作的:胜利一个队得3分,平分1分,失败0分。
首先,球队按积分顺序排在积分榜上,分数相等比较净胜球,净胜球相等比较进球数。

排序的话 根据 分数 净胜球 进球数来排序

反正就是明白输入之后就很简单了

// score - > win - > ball 分别表示 分数净胜球 进球数
#include <bits/stdc++.h>
#define rep(i,j,n) for(register int i=j;i<=n;i++)
#define Rep(i,j,n) for(register int i=j;i>=n;i--)
#define low(x) x&(-x)
using namespace std ;
typedef long long LL ;
const int inf = INT_MAX >> 1 ;
inline LL In() { LL res(0) , f(1) ; register char c ;
#define gc c = getchar()
while(isspace(gc)) ; c == '-' ? f = - 1 , gc : 0 ;
while(res = (res << 1) + (res << 3) + (c & 15) , isdigit(gc)) ;
return res * f ;
#undef gc
} const int N = 50 + 5 ;
int n ;
struct node {
string name ;
int score ;
int win ;
int ball ;
}a[N] ;
map < string , int > score , win , ball ; bool cmp(node x , node y) {
// score - > win - > ball
if(x.score != y.score) return x.score > y.score ;
else {
if(x.win != y.win) return x.win > y.win ;
return x.ball > y.ball ;
}
}
bool cmp2(node x , node y) {
return x.name < y.name ;
}
inline void Ot() {
n = In() ;
rep(i,1,n) {
cin >> a[i].name ;
a[i].score = a[i].ball = a[i].win = 0 ;
}
rep(i,1,n*(n-1) >> 1) {
string s1 , s2 ;
register char c ;
//scanf("%s-%s %d:%d",&s1,&s2,&_1,&_2) ;
#define gc c = getchar()
while(isspace(gc)) ;
s1 += c ;
while(islower(gc) or isupper(c)) s1 += c ;
while(islower(gc) or isupper(c)) s2 += c ;
int x = In() , y = In() ;
if(x > y) score[s1] += 3 ;
if(x == y) score[s1] ++ , score[s2] ++ ;
if(x < y) score[s2] += 3 ;
win[s1] += (x - y) , win[s2] += (y - x) ;
ball[s1] += x , ball[s2] += y ;
}
rep(i,1,n) {
a[i].score = score[a[i].name] ;
a[i].ball = ball[a[i].name] ;
a[i].win = win[a[i].name] ;
}
sort(a+1,a+n+1,cmp) ;
sort(a+1,a+(n>>1)+1,cmp2) ;
rep(i,1,(n>>1)) cout << a[i].name << endl ;
}
signed main() {
// freopen("test.in","r",stdin) ;
return Ot() , 0 ;
}

随机推荐

  1. [NOIP2005] 提高组 洛谷P1051 谁拿了最多奖学金

    题目描述 某校的惯例是在每学期的期末考试之后发放奖学金.发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1 ...

  2. Tyvj 1221 微子危机——战略

    背景 №.3Summer联盟战前兵力战略转移. 描述 Summer的兵力分布在各个星球上,现在需要把他们全部转移到某个星球上.Summer一共拥有N个星球(1-N),你要把这N个星球上的兵力转到第M个 ...

  3. 【Eclipse】eclipse中设置tomcat启动时候的JVM参数

    主要通过以下的几个jvm参数来设置堆内存的: -Xmx512m 最大总堆内存,一般设置为物理内存的1/4 -Xms512m 初始总堆内存,一般将它设置的和最大堆内存一样大,这样就不需要根据当前堆使用情 ...

  4. Linux下汇编语言学习笔记34 ---

    这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...

  5. 对付 MySQL 的死连接,Sleep的进程的来源探究[转]

    当前的连接数:mysql> show status like '%Threads_connected%';+-------------------+-------+| Variable_name ...

  6. 快速幂取模模板 && 51nod 1013 3的幂的和

    #include <iostream> #include <cstdio> #include <cmath> #include <vector> #in ...

  7. nodejs window下安装与配置淘宝镜像

    1,前往nodejs官网下载安装软件,地址:https://nodejs.org/en/ 2,点击下一步继续安装,安装完成,在命令输入:node -v,npm -v,查看版本,即是安装成功 3,随便在 ...

  8. Ubuntu 16.04安装WebStorm

    前提:必须正确安装JDK. 下载: http://confluence.jetbrains.com/display/WI/WebStorm+EAP 或者下载历史版本:https://www.jetbr ...

  9. Windows 10 S中的Device Guard详解(上篇)

    本文探讨Windows 10 S(下称Win10S)中的Device Guard(设备保护,下称DG).我将提取策略,并弄清楚在默认Win10S系统上可以和不可以运行什么.我将在下一篇文章中介绍在不安 ...

  10. Android ListView的item点击无响应的解决方法

    假设listitem里面包含button或者checkbox等控件,默认情况下listitem会失去焦点,导致无法响应item的事件,最经常使用的解决的方法 是在listitem的布局文件里设置des ...