$CF19A\ World\ Football\ Cup$
炒鸡\(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 ;
}
随机推荐
- Codeforces Round #264 (Div. 2) D
题意: 给出最多5个序列,问这几个序列的最长公共子序列的长度是多少. solution : 脑抽级别我是,第一个序列每个数字位置固定,这样只要维护一个k-1维的偏序集就好了.然后在保证每个位置合法的情 ...
- 【BZOJ2527】Meteors(整体二分)
题意: Byteotian Interstellar Union有N个成员国.现在它发现了一颗新的星球,这颗星球的轨道被分为M份(第M份和第1份相邻),第i份上有第Ai个国家的太空站. 这个星球经常会 ...
- 【重要】MySQL常见面试题
1. 主键 超键 候选键 外键 主 键: 数据库表中对储存数据对象予以唯一和完整标识的数据列或属性的组合.一个数据列只能有一个主键,且主键的取值不能缺失,即不能为空值(Null). 超 键: 在关系中 ...
- android中webview的实现
设置从当前页面打开链接,而不是跳转到系统默认浏览器打开: webview.setWebViewClient(new WebViewClient(){ @Override public boolean ...
- CSS实现自适应不同大小屏幕的背景大图的两种方法(转自简书)
CSS实现自适应不同大小屏幕的背景大图的两种方法 一张清晰漂亮的背景图片能给网页加分不少,设计师也经常会给页面的背景使用大图,我们既不想图片因为不同分辨率图片变形,也不希望当在大屏的情况下,背景有一块 ...
- AOJ731(不等式)
题意:有n(n<=100)个石头,每个石头的价值在Ai~Bi(1<=Ai<=Bi<=10000)之间,将这些石头分给两个人,求两个人的最大总价值差的最小值 分析: 与一般的求最 ...
- 第三课 MongoDB 数据更新
1.课程大纲 本课程主要解说 MongoDB 数据更新的相关内容.包含文档插入 insert 函数.文档删除 remove函数以及文档更新update函数的基本使用.除此之外.还会介绍 MongoDB ...
- 【DataStructure】Charming usage of Set in the java
In an attempt to remove duplicate elements from list, I go to the lengths to take advantage of meth ...
- powerShell赋权限
1.给网站赋权限 Set-SPUser –Identity “用户名” –AddPermissionLevel “参与讨论” –web “http://url” 2.给列表赋权限 $web = Get ...
- jmeter实现Http接口测试介绍
构建一个测试页面 页面功能测试说到底就是模拟用户浏览点击页面的全过程,很多的测试工具都可以对该过程进行录制后模拟用户操作,而压力测试就是将这个过程在单位时间内重复成千上万次,看检测应用的高可用,接下来 ...