[Brian Dean, 2014] Bessie the cow is competing in a cross-country skiing event at the winter Moolympic games. She starts out at a speed of 1 meter per second. However, as she becomes more tired over time, she begins to slow down. Each time Bessie slows down, her speed decreases: she moves at 1/2 meter per second after slowing down once, then 1/3 meter per second after slowing down twice, and so on. You are told when and where Bessie slows down, in terms of a series of events. An event like this:
T 17
means that Bessie slows down at a specific time -- here, 17 seconds into the race. An event like this:
D 10
means that Bessie slows down at a specific distance from the start -- in this case, 10 meters. Given a list of N such events (1 <= N <= 10,000), please compute the amount of time, in seconds, for Bessie to travel an entire kilometer. Round your answer to the nearest integer second (0.5 rounds up to 1).
贝西正在参加一项滑雪比赛。她从起点出发的时候,速度恒定为每秒 1 米。然而,随着比赛进程的增加,她会犯很多错误,每次失误都会使她的速度下降。当她第一次失误后,速度会下降到每秒1/2 米,第二次失误后,速度会下降到每秒 1/3 米,第 k 次失误后,速度会下降到每秒 1/(k +1) 米。约翰记录了贝西的所有失误,一共有 Q 个。有两种失误,一种发生在比赛开始后的某个时间点,
另一种发生在赛道的某个位置上。有时,贝西可能在某个时间点到达某个位置,而恰好在这个时间点和位置上都有一次失误的记录,这两个记录要算作不同的失误,会对贝西的速度造成两次影响。比赛的终点距离起点有 1000 米,请问贝西需要多少时间才能滑过终点?