HBC24251循环右移[USACO 2018 Jan S]Lifeguards题解

你曾走过我的故事 算法基础篇 53 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
Farmer John has opened a swimming pool for his cows, figuring it will help them relax and produce more milk. To ensure safety, he hiresNcows as lifeguards, each of which has a shift that covers some contiguous interval of time during the day. For simplicity, the pool is open from timet=0until timet=1,000,000,000on a daily basis, so each shift can be described by two integers, giving the time at which a cow starts and ends her shift. For example, a lifeguard starting at timet=4and ending at timet=7covers three units of time . Unfortunately, Farmer John hired 1 more lifeguard than he has the funds to support. Given that he must fire exactly one lifeguard, what is the maximum amount of time that can still be covered by the shifts of the remaining lifeguards?An interval of time is covered if at least one lifeguard is present.

Farmer John has opened a swimming pool for his cows, figuring it will help them relax and produce more milk. To ensure safety, he hires N cows as lifeguards, each of which has a shift that covers some contiguous interval of time during the day. For simplicity, the pool is open from time t=0 until time t=1,000,000,000 on a daily basis, so each shift can be described by two integers, giving the time at which a cow starts and ends her shift. For example, a lifeguard starting at time t=4 and ending at time t=7 covers three units of time (note that the endpoints are "points" in time). Unfortunately, Farmer John hired 1 more lifeguard than he has the funds to support. Given that he must fire exactly one lifeguard, what is the maximum amount of time that can still be covered by the shifts of the remaining lifeguards? An interval of time is covered if at least one lifeguard is present.

HBC24251循环右移[USACO 2018 Jan S]Lifeguards题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC24251循环右移[USACO 2018 Jan S]Lifeguards题解