19A World Football Cup

A. World Football Cup
time limit per test
2 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:

  • the final tournament features n teams (n is always even)
  • the first n / 2 teams (according to the standings) come through to the knockout stage
  • the standings are made on the following principle: for a victory a team gets 3 points, for a draw — 1 point, for a defeat — 0 points. In the first place, teams are ordered in the standings in decreasing order of their points; in the second place — in decreasing order of the difference between scored and missed goals; in the third place — in the decreasing order of scored goals
  • it's written in Berland's Constitution that the previous regulation helps to order the teams without ambiguity.

You are asked to write a program that, by the given list of the competing teams and the results of all the matches, will find the list of teams that managed to get through to the knockout stage.

Input

The first input line contains the only integer n (1 ≤ n ≤ 50) — amount of the teams, taking part in the final tournament of World Cup. The following n lines contain the names of these teams, a name is a string of lower-case and upper-case Latin letters, its length doesn't exceed 30 characters. The following n·(n - 1) / 2 lines describe the held matches in the format name1-name2 num1:num2, where name1name2 — names of the teams; num1num2(0 ≤ num1, num2 ≤ 100) — amount of the goals, scored by the corresponding teams. Accuracy of the descriptions is guaranteed: there are no two team names coinciding accurate to the letters' case; there is no match, where a team plays with itself; each match is met in the descriptions only once.

Output

Output n / 2 lines — names of the teams, which managed to get through to the knockout stage in lexicographical order. Output each name in a separate line. No odd characters (including spaces) are allowed. It's guaranteed that the described regulations help to order the teams without ambiguity.

Examples
input
4
A
B
C
D
A-B 1:1
A-C 2:2
A-D 1:0
B-C 1:0
B-D 0:3
C-D 0:3
output
A
D
input
2
a
A
a-A 2:1
output
a


题意:世界杯足球比赛,输入n个足球队。然后每个足球队互相一场比赛,赢了的队+3分,平局两支队各加一分,输了不加分。总共进行n*(n-1)场比赛,经过淘汰赛,淘汰一半队伍,然我输出最后留下的队伍名字。****按字典序输出留下的队伍****。

题解:模拟,用map模拟比赛的过程,把对应的分数加上,但是这是遇到最麻烦的A题,没有之一!本来只需要用map记录每个队伍的得分就行的,然后哦排序,分数从高到底排。就能输出留下的队伍,但是!!!对留下的队伍字典序排序,你以为很简单吗?把留下的队伍在排一次序?我刚开始就这么整的,但是wa第四组,

4
TeMnHVvWKpwlpubwyhzqvc
AWJwc
bhbxErlydiwtoxy
EVASMeLpfqwjkke
AWJwc-TeMnHVvWKpwlpubwyhzqvc 37:34
bhbxErlydiwtoxy-TeMnHVvWKpwlpubwyhzqvc 38:99
bhbxErlydiwtoxy-AWJwc 33:84
EVASMeLpfqwjkke-TeMnHVvWKpwlpubwyhzqvc 79:34
EVASMeLpfqwjkke-AWJwc 24:37
EVASMeLpfqwjkke-bhbxErlydiwtoxy 3:6

4组数据留两个队伍,第一名 AWJwc最高分没问题,字典序也是第一个输出,但是TeMnHVvWKpwlpubwyhzqvc和EVASMeLpfqwjkke队伍得分相同。而在第一次排排序的时候,按照的是先后顺序,也就是AWJwc,TeMnHVvWKpwlpubwyhzqvc,EVASMeLpfqwjkke........这样排的,第二次按照字典序排序,输出两个的时候,不会去管E那个队伍,如果你想按照字典序全部排的话,那样又有问题了,第一次排的大小等于没排,只是按照字典序排,输出的就不是应该留下的队伍了。所以要map,用三个,分别记录,每个队伍的得分,还要记录,每个队伍得到的总分,每个队伍的每场比赛的差分。来判断....参考别人代码发现的....还有点懵

#include<bits/stdc++.h>
using namespace std;
map<string,int>m,g,gm;
bool cmp(string s1,string s2)
{
    if(m[s1]!=m[s2])
        return m[s1]>m[s2];
    if(gm[s1]!=gm[s2])
        return gm[s1]>gm[s2];
    return g[s1]>g[s2];
}
int main()
{
    string s,s1,s2,name[55];
    char c;
    int n,g1,g2;
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>name[i];
    for(int i=0; i<n*(n-1)/2; i++)
    {
        cin>>s>>g1>>c>>g2;
        s1=s.substr(0,s.find("-"));///substr分割从0开始到'-'的字符串表示队伍s1
        s2=s.substr(s.find("-")+1);///分给从'-'下一位开始到字符串结束的字符串表示队伍s2
        if(g1==g2)
        {
            m[s1]++;       ///两个分数相等,平局各加1分
            m[s2]++;
        }
        else m[g1>g2?s1:s2]+=3;///三目运算,取分数大的队伍,加+3分,输的队伍不得分
        g[s1]+=g1,g[s2]+=g2;   ///记录每个队伍总分
        gm[s1]+=g1-g2,gm[s2]+=g2-g1;///记录每个队伍比赛的差分
    }
    sort(name,name+n,cmp);///留下的队排序
    sort(name,name+n/2);  ///字典排序
    for(int i=0; i<n/2; i++)
        cout<<name[i]<<endl;
    return 0;
}


深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

落凡尘.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值