HBC14364Balloon Robot题解

别敷衍了所有 算法基础篇 34 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
The 2017 China Collegiate Programming Contest Qinhuangdao Site is coming!

The 2017 China Collegiate Programming Contest Qinhuangdao Site is coming! There will be n teams participating in the contest, and the contest will be held on a huge round table with m seats numbered from 1 to m in clockwise order around it. The i-th team will be seated on the si-th seat. BaoBao, an enthusiast for competitive programming, has made p predictions of the contest result before the contest. Each prediction is in the form of (ai,bi), which means the ai-th team solves a problem during the bi-th time unit. As we know, when a team solves a problem, a balloon will be rewarded to that team. The participants will be unhappy if the balloons take almost centuries to come. If a team solves a problem during the ta-th time unit, and the balloon is sent to them during the tb-th time unit, then the unhappiness of the team will increase by tb-ta. In order to give out balloons timely, the organizers of the contest have bought a balloon robot. At the beginning of the contest (that is to say, at the beginning of the 1st time unit), the robot will be put on the k-th seat and begin to move around the table. If the robot moves past a team which has won themselves some balloons after the robot’s last visit, it will give all the balloons they deserve to the team. During each unit of time, the following events will happen in order:         1.The robot moves to the next seat. That is to say, if the robot is currently on the i-th(1 ≤ i < m) seat, it will move to the (i + 1)-th seat; If the robot is currently on  the  m-th seat, it will move to the 1st seat.         2.The participants solve some problems according to BaoBao’s prediction.         3.The robot gives out balloons to the team seated on its current position if needed. BaoBao is interested in minimizing the total unhappiness of all the teams. Your task is to select the starting position k of the robot and calculate the minimum total unhappiness of all the teams according to BaoBao’s predictions.

HBC14364Balloon Robot题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC14364Balloon Robot题解