HBC223617[NOIP1998]车站,数学,NOIP复赛ARetribution!题解

原来我爱你 算法基础篇 53 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
The coaches in a certain regional are fed up with the judges. During the last contest over 90% of the teams failed to solve a single problem—in fact, even half the judges found the problems too hard

The coaches in a certain regional are fed up with the judges. During the last contest over 90% of the teams failed to solve a single problem—in fact, even half the judges found the problems too hard to solve. So the coaches have decided to tar and feather the judges. They know the locations of all the judges as well as the locations of tar repositories and feather storehouses. They would like to assign one repository and one storehouse to each judge so as to minimize the total distances involved. But this is a hard problem and the coaches don’t have time to solve it (the judges are evil but not stupid—they have a sense of the unrest they’ve fomented and are getting ready to leave town). So instead they’ve decided to use a greedy solution. They’ll look for the smallest distance between any tar repository and any judge location and assign that repository to that judge. Then they’ll repeat the process with the remaining repositories and judges until all the judges have a repository assigned to them. After they’re finished with the tar assignments they’ll do the same with the feather storehouses and the judges. Your job is to determine the total distances between repositories and storehouses and their assigned judges.  All judges, tar repositories and feather storehouses are numbered 1, 2, . . .. In case of any ties, always assign a repository/storehouse to the lowest numbered judge first. If there is still a tie, use the lowest numbered repository/storehouse.  Better hurry up—an unmarked van has just been spotted pulling up behind the judges’ room

HBC223617[NOIP1998]车站,数学,NOIP复赛ARetribution!题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC223617[NOIP1998]车站 数学 NOIP复赛ARetribution!题解