当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3647:Tournament

Special Judge 特殊评判
题目描述

Every September, the Kingdom of Loowater holds a jousting tournament. In each of a series of event, a pair of knights attempt to knock each other from their respective horses. The winning knight is paired with another, while the loser is elimnated. This process continues until all but one knight is eliminated; this knight is declared champion.

The tournament schedule is organized so that no knight needs to compete in more than e events to be champion, for the minimum possible e given k, the number of knights. In order to construct the schedule, it may be necessary to identify several knights who compete in fewer than e events; these knights are said to be awarded a bye and are excluded from the first round of competition.

The first round of competition involves pairing as many knights as possible among those who are not awarded a bye. The competition is more interesting if the knights in each pair are as evenly matched in ability as possible. You are to determine which knights should be awarded a bye so as to make the first round as interesting as possible.

输入解释

Standard input consists of several test cases followed by a line containing 0. Each test case begins with an integer 1 < k ≤ 2500, the number of knights. k lines follow, each giving the name and ability of a knight. The name is a string of lower case letters not longer than 20; the ability is a real number.

The mismatch between knights with abilities a and b respectively is defined to be (a - b)2.

输出解释

For each test case, output the names of the knights to be given a bye such that the sum of all mismatch values for pairs of knights competing in the first round is minimized. If there are several solutions, any will do. Output an empty line between test cases.

输入样例
3
gallahad 10
lancelot 11
mccartney 2
0
输出样例
mccartney

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3647

最后修改于 2020-10-29T07:06:53+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536