QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#4066. 最佳接力队

Statistics

你是国家田径队的教练,需要选拔短跑运动员参加即将到来的锦标赛中的 $4 \times 100$ 米接力赛。

Picture by Fernando Frazão/Agência Brasil, cc by

顾名思义,这项短跑接力赛由 4 棒组成,每棒 100 米。人们可能会认为最强的队伍应该由全国跑得最快的 4 名 100 米选手组成,但有一个重要的细节需要考虑:助跑起跑。在第 2、3 和 4 棒中,当接力棒交接时,运动员已经在奔跑了。这意味着一些运动员——那些加速阶段较慢的选手——如果被安排在第 2、3 或 4 棒,在接力赛中的表现会相对更好。

你有一组候选运动员。根据每位运动员的速度,决定哪四名运动员应该代表国家队,以及他们分别跑哪一棒。对于每位运动员,你已知两个时间:该运动员跑第 1 棒所需的时间,以及该运动员跑其余任意一棒所需的时间。每名运动员在队伍中只能跑一棒。

输入格式

输入的第一行包含一个整数 $n$,表示候选运动员的人数 ($4 \le n \le 500$)。

接下来 $n$ 行描述这些运动员。第 $i$ 行包含第 $i$ 名运动员的姓名、跑第 1 棒的时间 $a_i$ 以及跑其余任意一棒的时间 $b_i$ ($8 \le b_i \le a_i < 20$)。姓名由 2 到 20 个(含)大写字母 ‘A’-‘Z’ 组成,且没有两名运动员姓名相同。时间以秒为单位,小数点后恰好有两位数字。

输出格式

首先,输出一行,包含最佳队伍的总时间。时间的精确格式不作要求。然后输出四行,包含该队伍中运动员的姓名。第一行应包含你为第 1 棒选定的运动员,第二行包含你为第 2 棒选定的运动员,以此类推。任何能得到最快队伍的方案都是可接受的。

样例

输入格式 1

6
ASHMEADE 9.90 8.85
BLAKE 9.69 8.72
BOLT 9.58 8.43
CARTER 9.78 8.93
FRATER 9.88 8.92
POWELL 9.72 8.61

输出格式 1

35.54
CARTER
BOLT
POWELL
BLAKE

输入格式 2

9
AUSTRIN 15.60 14.92
DRANGE 15.14 14.19
DREGI 15.00 14.99
LAAKSONEN 16.39 14.97
LUNDSTROM 15.83 15.35
MARDELL 13.36 13.20
POLACEK 13.05 12.55
SANNEMO 15.23 14.74
SODERMAN 13.99 12.57

输出格式 2

52.670000
MARDELL
POLACEK
SODERMAN
DRANGE

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.